0
I think system.out.print is enough to display the output , but why we are using println , can anyone??
6 Respuestas
+ 3
println adds a line break at then end of the output, for example:
System.out.print("hello");
System.out.print("world!");
//Prints:
//helloworld!
System.out.println("hello");
System.out.println("world!");
//Prints:
//hello
//world!
+ 2
And
System.out.println("Hello");
System.out.print("World!!");
Will print
Hello
World!!
+ 1
1. print("Hello\nJava");
2. println("Hello");
print("Java");
Both the above cases give the result as
Hello
Java
0
What Wagner said
0
Make code simple
0
print statement will print all the strings in single line
println statement print in next line.. we use both statements according to the requirement.