“public static void main(String args[])”的 Eclipse 快捷方式是什么?
我知道 System.out.println()
的一个很酷的快捷方式:sysout Ctrl + Space。
public static void main(String args[])
有类似的东西吗?
I know a cool shortcut for System.out.println()
: sysout Ctrl + Space.
Is there something similar for public static void main(String args[])
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
这只是
main
和 Ctrl-Space。This is just
main
and Ctrl-Space.在 Eclipse 中,选择首选项。
在首选项中,查找 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.
只需输入
ma
并按 Ctrl + 空格,您就会看到一个选项。Just type
ma
and press Ctrl + Space, you will get an option for it.正如 bmargulies 提到的:
首选项>Java>编辑器>模板>新建...
现在,输入 psvm,然后
Ctrl + Space< /code> 在 Mac 或 Windows 上。
As bmargulies mentioned:
Preferences>Java>Editor>Templates>New...
Now, type psvm then
Ctrl + Space
on Mac or Windows.输入
main
并按住 Ctrl 然后按 Space Space (双倍空格)并选择,或者按输入以关注主选项。这是最快的方法。
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.
或者,您可以通过单击一次来启动包含该行的程序。
只需在创建新 Java 类时为其选择方法存根,其中代码显示:
哪个方法存根你想创造吗?
[check-box] public static void main(String[]args) <---- 选择此一项。
[check-box] > 来自超类的构造函数
[check-box] 继承的抽象方法
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
只需输入 main 并按 Ctrl + Space,您就会看到一个选项。
Just type main and press Ctrl + Space, and you will get an option for it.