How do you get Eclipse to auto-generate a main method for a new Java class?
Type main
and press ctrl+space. The eclipse content assist will pop up with main method. Press enter.
"what can i do to make it appear automatically? "
- Go to create New Java Class dialog
- See a part that says "Which method stubs would you like to create?"
- check
public static void main(String[] args)
I think the best practise is to use only keyboard. It makes workflow a lot faster.
- Create new java class with
Ctrl+n
- on dialog box, enter its (class) name
- use
(left)Alt+v
to easily tick checkbox for -public static void main(String[] args)
- then press
[enter]
Finish and voila class is ready...