Site icon Automation Dojos

Shortcut To Auto-Insert ‘main’ Method in IntelliJ

IntelliJ Live Templates

Live templates let you insert frequently-used or custom code constructs into your source code file quickly and efficiently

IntelliJ IDEA comes with a set of predefined Live Templates. You can use them as-is, or modify them to suit your needs. If you want to create a new live template, you can do it from scratch, on the basis of the copy of an existing template, or from a fragment of source code. Live templates are stored in the following location:

  • Windows: \.IntelliJ IDEA\config\templates.
  • Linux: ~IntelliJ IDEA/config/templates.
  • OS X: ~/Library/Preferences/IntelliJ IDEA/templates.

Shortcut For ‘main’ Method

OPTION 1: In IntelliJ IDEA, type ‘psvm’ and press TAB to automatically generate a ‘main’ method

OPTION 2: You can also generate ‘main’ method by simply typing ‘main’ and then press TAB

View All Available Shortcuts

To view all default ‘Live Templates’ type Ctrl + J

You can also view, edit or create shortcuts from the settings. Navigate to File > Settings > Live Templates

Exit mobile version