+ 1
println vs print
At what point do we use: System.out.print instead of System.out.println ?
3 Answers
+ 3
println() is used to print in the next line while print () is for printing in the same line.
e.g. :
1. System.out.println("hello")
System.out.println("world")
output : hello
world
2. System.out.print("hello")
System.out.print("world")
output : hello world
+ 1
print vs println
print : in current line
println : in new line
is work like "\n"
- 6
they are both the same right but for me print is used to get user input while println is for the output