Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the eclipse java declaration shortcut?

Tags:

java

eclipse

There´s any eclipse shortcut to stance a new object ? For example. I would like to type:

Object zzz = 

and it would complete for me this way:

Object zzz = new Object();

with void parameter of course. I will wait answers.. thank you people.

like image 309
Felipe Avatar asked May 25 '10 17:05

Felipe


People also ask

What is Ctrl K in Eclipse?

In Eclipse, if the cursor is over a word and you press Ctrl + K you will jump to the next occurrence of that word in the file.

What does F7 do in Eclipse?

F7 steps out to the caller of the currently executed method. This finishes the execution of the current method and returns to the caller of this method. F8 tells the Eclipse debugger to resume the execution of the program code until is reaches the next breakpoint or watchpoint.


1 Answers

Try the template 'new':

1) type new and then ctrl+space.

2) Choose the 'create new object' option

3) Insert the class name and parameters (if needed)

If you don't want the parameters, you can create a template yourself (preferences->java->editor->templates). Assign a unique name to it, and set the pattern to:

${type} ${name} = new ${type}();
like image 65
Eyal Schneider Avatar answered Sep 22 '22 16:09

Eyal Schneider