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

删除回忆录丶 提交于 2021-01-20 14:10:17

问题


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

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


回答1:


This is just main and Ctrl-Space.




回答2:


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.




回答3:


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




回答4:


As bmargulies mentioned:

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

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




回答5:


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.




回答6:


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.




回答7:


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



来源:https://stackoverflow.com/questions/7813153/what-is-the-eclipse-shortcut-for-public-static-void-mainstring-args

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!