I know a cool shortcut for System.out.println()
: sysout Ctrl + Space.
Is there something similar for public static void main(String args[])
?
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.
Just type ma
and press Ctrl + Space, you will get an option for it.
m
and press Ctrl
+ Space
, you will get an option for it. :D
Commented
Oct 29, 2013 at 2:01
Ctrl
+ Space
and you will get a list that you later can choose it from.
As bmargulies mentioned:
Preferences>Java>Editor>Templates>New...
Now, type psvm then Ctrl + Space
on Mac or Windows.
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.
ctrl + space + space
is to show all shortcuts that eclipse is made but ctrl+space
is contained Classes and shortcuts..by double space way we can seperate these from Classes
Commented
Apr 15, 2017 at 17:31
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.
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
Just type main and press Ctrl + Space, and you will get an option for it.