What is the Eclipse shortcut for "public static void main(String args[])"?

JavaEclipseKeyboard ShortcutsMain

Java Problem Overview


I know a cool shortcut for System.out.println(): sysout Ctrl + Space.

Is there something similar for public static void main(String args[])?

Java Solutions


Solution 1 - Java

This is just main and Ctrl-Space.

Solution 2 - Java

In Eclipse, select preferences.

In preferences, look for Java/Editor/Templates.

Here you will see a list of all of them. And you can even add your own.

Solution 3 - Java

Just type ma and press Ctrl + Space, you will get an option for it.

Solution 4 - Java

As bmargulies mentioned:

Preferences>Java>Editor>Templates>New...

enter image description here

enter image description here

Now, type psvm then Ctrl + Space on Mac or Windows.

Solution 5 - Java

Type main and press and hold Ctrl and next press Space Space (double space) and select, it or pressenter to focus on main option.

This is fastest way.

Solution 6 - Java

> To get public static void main(String[] args) line in eclipse without > typing the whole line type "main" and press Ctrl + space then, you > will get the option for the main method select it.

enter image description here

Solution 7 - Java

Alternately, you can start a program containing the line with one click.

Just select the method stub for it when creating the new Java class, where the code says,

Which method stubs would you like to create?

[check-box] public static void main(String[]args) <---- Select this one.

[check-box] Constructors from superclass

[check-box] Inherited abstract methods

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser244333View Question on Stackoverflow
Solution 1 - JavacorsiKaView Answer on Stackoverflow
Solution 2 - JavabmarguliesView Answer on Stackoverflow
Solution 3 - JavaVishwaView Answer on Stackoverflow
Solution 4 - Javaraja777mView Answer on Stackoverflow
Solution 5 - JavaABOLFAZL_GH_IN_LOVE_WITH_JAVAView Answer on Stackoverflow
Solution 6 - JavaAzarEJView Answer on Stackoverflow
Solution 7 - JavaCaleb WoodmanView Answer on Stackoverflow