why we use print instead of println in some of java codes? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

why we use print instead of println in some of java codes?

31st Jul 2020, 11:11 AM
RAHUL SINGLA
RAHUL SINGLA - avatar
2 Answers
+ 2
Try printing something using both method and notice the difference 👍
31st Jul 2020, 11:14 AM
Ipang
+ 2
Print method in Java is used to display a text on the console. This text is passed as the parameter to this method in the form of String. This method prints the text on the console and the cursor remains at the end of the text at the console. The next printing takes place from just here. Println method in Java is also used to display a text on the console. This text is passed as the parameter to this method in the form of String. This method prints the text on the console and the cursor remains at the start of the next line at the console. The next printing takes place from next line.
31st Jul 2020, 1:14 PM
Vishakha Shrivastav
Vishakha Shrivastav - avatar