“ public static void main (String args [])”的 Eclipse 快捷方式是什么?

我知道一个很酷的 System.out.println()快捷方式: sysout Ctrl + Space

public static void main(String args[])有类似的东西吗?

120713 次浏览

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.

This is just main and Ctrl-Space.

Just type ma and press Ctrl + Space, you will get an option for 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

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.

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.

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

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