How to Make System. Out. Println() Shorter
Please Advice on Where Can I Find the Lib in Order to Use the Shorter Expression of System. Out. Println() and Where Should I Place That Lib. 9 12 Answers...
Please advice on where can I find the lib in order to use the shorter expression of System.out.println() and where should I place that lib.
12 Answers
Logging libraries
You could use logging libraries instead of re-inventing the wheel. Log4j for instance will provide methods for different messages like info(), warn() and error().
Homemade methods
or simply make a println method of your own and call it:
void println(Object line) {
System.out.println(line);
}
println("Hello World");
IDE keyboard shortcuts
IntelliJ IDEA and NetBeans:
you type sout then press TAB, and it types System.out.println() for you, with the cursor in the right place.
Eclipse:
Type syso then press CTRL + SPACE.
Other
Find a "snippets" plugin for your favorite text editor/IDE
Static Import
import static java.lang.System.out;
out.println("Hello World");
Explore JVM languages
Must Read
Scala
println("Hello, World!")