Java Program | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Java Program

Why do we write System.out.println();? what is the meaning of the statement or what is the role of this statement?Can we write any other statement instead of System.out.println?

9th Nov 2017, 5:14 PM
Shivani Goyal
6 Answers
+ 1
we write a System.out.println() to display the content which we write. It have meaning like System.out.println(): System is a predefine class and out is present in system class as a method and print is present in out class as a method.It is a hierarchical view. It is define in java JDK already. next Yes, we write a another word in the place of System.out.print on.
4th Jan 2018, 12:57 PM
tarun
tarun - avatar
+ 6
You're using the `System` namespace and the `out` (output) class that's found in it. Println() and Print() are both methods of the out class. Println() is going to print the output and automatically add a newline (\n) to the end of it. Print() is going to print the output but not return to a newline. At the top of your code put: import static java.lang.System.out; ^That will allow you to drop the System. from it, so then you can just type out.println("What I want to print here."); instead of having to type out the whole thing.
9th Nov 2017, 5:25 PM
AgentSmith
+ 3
It's calling the standart output to print an empty line on the console.
9th Nov 2017, 5:22 PM
Boris Batinkov
Boris Batinkov - avatar
+ 3
It is important if you need your output to be displayed in the Output Window. there are two ways to make your output visible when you run the program 1 ) System.out.println() :: It prints your output plus, if there is a second thing to be printed it will be printed automatically in the next line. 2 ) System.out.print() :: It prints your output but in this, the next thing you are printing will not be printed in the next line. it will be printed next to the first output. Try it in your Code Playground man. ! It will make you learn better. Practice Makes You Perfect !!! As SL always says. Try it man. !
10th Nov 2017, 9:00 AM
Aaron Stone
Aaron Stone - avatar
+ 3
thank you Mr. Tarun. I m completely satisfied to your answer
4th Jan 2018, 1:04 PM
Shivani Goyal
0
booaa
30th Nov 2017, 9:27 AM
tejas kudale