简体   繁体   中英

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 .

eg after writing Demo followed by that shortcut , it should write as below

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).

Eclipse will change the line to Demo demo = new Demo(); and give you a chance to rename the variable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM