In this post, we will see about System.out.println shortcut in intellij.
You often need to print output on console using Syste.out.println
to view the output. Although log4j or java.util.logger is recommended for logging any information for production code, but System.out.println
is most preferred way to print anything on console quickly.
Table of Contents
System.out.println()
to use it quickly and efficiently.
intellij shortcut for System.out.println
There are two eclipse shortcuts, you can use to write System.out.println.
- You can type
sout
and presstab
to autocomplete it.
- You can print variable value by typing
$variableName.sout
and presstab
For example: If variable name isstr
, then you can typestr.sout
and press tab to print the variable.
All intellij live templates
if you want to explore list of all live templates provided by intellij.
You can go to Settings
->Live Templates
Here are some other live templates related to System.out.println which you can use:
soutm
: Print current class name and method to console
1 2 3 |
System.out.println("$CLASS_NAME$.$METHOD_NAME$"); |
soutp
: Print method parameter names and values to console
1 2 3 |
System.out.println($FORMAT$); |
soutv
: Print a value to console
1 2 3 |
System.out.println("$EXPR_COPY$ = " + $EXPR$); |
That’s all about System.out.println shortcut in intellij.