Shortcut To Auto-Insert ‘main’ Method in IntelliJ

Auto-Insert 'Main' Method using 'Live Template' 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

blank

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

blank

View All Available Shortcuts

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

blank

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

blank
Tushar Sharma
Tushar Sharmahttps://www.automationdojos.com
Hi! This is Tushar, the author of 'Automation Dojos'. A passionate IT professional with a big appetite for learning, I enjoy technical content creation and curation. Hope you are having a good time! Don't forget to subscribe and stay in touch. Wishing you happy learning!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

RELATED POSTS

How To Always Open Files in New Tab in VSCode

The VSCode has rocketed its way to one of the top development IDEs due to its fresh look, usability, tons of feature sets, and...

How To Add SSH Private Keys to Eclipse

One of the common use cases for accessing Git repositories on Github is authentication via SSH keys. This offers a secure way of working...

How to View Java API Doc Hints within IntelliJ

IntelliJ Quick Documentation So how do you generally refer your Java API Doc? If you use Google or online Java API Doc or even a...

Â

RECENT 'HOW-TO'

How To Install Oh-My-Posh On Windows PowerShell

Oh-My-Posh is a powerful custom prompt engine for any shell that has the ability to adjust the prompt string with a function or variable. It does not...

SIMILAR ON CODEX

FEATURED PROJECTS

SEPA Bulk File Generator and Validator

ADjo LABS PROJECT: SEPA Bulk File Generator and Validator. Supported File Types PAIN008, PAIN001, PACS003 and PACS008. Tested for supporting PAIN.008.001.001 and PAIN.008.001.002 (version 1&2). The XML...

MORE IN THIS CATEGORY

How To Add SSH Private Keys to Eclipse

One of the common use cases for accessing Git repositories on Github is authentication via SSH keys. This offers a secure way of working...

How To Always Open Files in New Tab in VSCode

The VSCode has rocketed its way to one of the top development IDEs due to its fresh look, usability, tons of feature sets, and...

How to View Java API Doc Hints within IntelliJ

IntelliJ Quick Documentation So how do you generally refer your Java API Doc? If you use Google or online Java API Doc or even a...

CHECKOUT TUTORIALS

Getting Started with Apache JMeter

1. Introduction As a developer, you may have tested the functionality of your code hundreds of times during development. This is known as functional testing....
- Advertisement -spot_img