Google+

158. Using shortcuts for System.out.println( ) statement in Eclipse IDE







As we know that, System.out.println(" "); is the most used statement in Java programming language. Instead of typing the complete Statement, we can actually use a shortcut for saving our time as shown below

type 'Sysout' and then press ctrl + space

and Eclipse IDE will automatically convert the above statement to System.out.println( );  there by saving your time.

Lets implement this on Eclipse IDE -

1. Launch Eclipse IDE, Create a new Java Project 'Project 007' , under it create a new Class 'ShortCut' with main( ) method as shown below - 




2. Now type Sysout into the main() method as shown below -




3. Place the Cursor at the end of 'Sysout' text and Press 'Ctrl' and 'Space bar' keys at the same time and observe that Eclipse IDE automatically converted Sysout to System.out.println( ); statement as shown below -




4. Enter the text 'Sysout shorcut' into the statement as shown below and save  -




5. Run the Java Class file 'ShortCut' 

6. Observe that the following output is displayed -





You can also type Syso and then press ctrl + space  as a shortcut for the same System.out.println( ); statement.

Lets implement this on Eclipse IDE -

1. Launch Eclipse IDE, open 'Project 007' -> 'ShortCut' Class, and type Syso instead of Sysout as shown below -


2. Place the Cursor at the end of 'Syso' text and Press 'Ctrl' and 'Space bar' keys at the same time and observe that Eclipse IDE automatically converted Syso to System.out.println( ); statement as shown below -




3. Enter the text 'Syso shorcut' into the statement as shown below and save  -


4. Run the 'ShortCut' Java Class file and observe that the output is displayed as shown below -



Hence we can use Syso or Sysout as shortcuts for System.out.println( ); statement for reducing time while coding.




Please comment below to feedback or ask questions.

Renaming Java Projects, Packages and Classes in Eclipse IDE will be explained in the next post. 




No comments: