How to add by default Static void main?

已回答

Like in Eclipse, when we create the new class, there is the option to add Static void main line, the same way, how can I add this to IntelliJ Java CE whenever create the new class?

0

You can edit Class file template and add a method there or create a new template like Class with Main.

Or just type "psvm" and press Tab after creating a class.

5
Avatar
Permanently deleted user

Thanks psvm works fine.

0
Avatar
Permanently deleted user

You can also check this site if you want to set psvm up as part of your java class template: https://www.jetbrains.com/help/idea/using-file-and-code-templates.html

Pretty much you have to go to File/ Settings/ Editor/ File and Code Templates, then select Class from the list of files and include in the code the psvm structure:

public static void main (String[] args) {

}

Hope it was helpful! :)

0

请先登录再写评论。