I think some shortcut to create a method stub in eclipse might be useful. Does anyone know how to do it?
Move the cursor beneath the main method, and enter the word private to make display a private method. Then, press Ctrl-Space to open code assist, as shown in Figure 3-8. Select the private static method item, and code assist will create the method template for you, as shown in Figure 3-9.
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.
Display and Edit the Current Keyboard Shortcuts To see the current key configuration and its keyboard shortcuts, choose the Eclipse > Preferences menu command to open the Eclipse workbench Preferences. Select the General > Editor > Keys page.
You have the option to have Eclipse generate method stubs (a method stub is a method which is defined but has no statements in it, or no functionality) for various types of methods.
Type public_method
(see Java/Editor/Templates in preferences for more options) or method name and press ctrl+space.
In Addtion to the accepted answer:
Typing pu
for a public method (with returntype
and name
)is enough:
Type pu
and then hit CTRL + SPACE and then ENTER.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With