[英]keyboard shortcut for class object in eclipse
class Demo{
static void Test(){
System.out.println("hello");
}
}
Is there any keyboard shortcut in eclipse for creating an object of a class declared above . 在eclipse中是否有任何键盘快捷键用于创建上面声明的类的对象。
eg after writing Demo followed by that shortcut , it should write as below 例如,在编写Demo后跟该快捷方式时,应该写如下
Demo objname = new Demo();
I don't think you can do exactly that, but this is close: 我不认为你能做到这一点,但这很接近:
Type new Demo()
then ctrl-2 L
(Quick Assist - Assign to local variable). 键入new Demo()
然后键入ctrl-2 L
(快速辅助 - 分配给局部变量)。
Eclipse will change the line to Demo demo = new Demo();
Eclipse会将该行更改为Demo demo = new Demo();
and give you a chance to rename the variable. 并给你一个重命名变量的机会。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.