+ 5

What is the deference System.out.print (); & System.out.printf();

24th Feb 2019, 1:59 PM
Nasir❤
Nasir❤ - avatar
4 Respuestas
+ 12
Unlike System.out.println() or System.out.print() which is type void (prints something and does not return anything), System.out.printf() is PrintStream type: prints something and returns PrintStream. System.out.println() and System.out.printf(): - System - is the final class from the java.lang package - out - is a class variable type PrintStream declared in System class - println - is the method of the PrintStream class - printf - is the method of the PrintStream class This explanation By LukarToDo.
27th Feb 2019, 6:13 PM
Sumit Programmer😎😎
Sumit Programmer😎😎 - avatar
+ 8
Using print() instead of println() does not break the line. • Java String Format Examples:- https://dzone.com/articles/java-string-format-examples  ⇨ Check thisOut:- https://alvinalexander.com/programming/printf-format-cheat-sheet //Thanks to Haris 😉🍻
28th Feb 2019, 7:53 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 5
Mike is right. It is not fair to downvote someone if he give not a wrong answer. Maybe the answer is a bit imprecise, but there you can ask what exactly is meant. System.out.print () --> print it and leave the cursor in the same line System.out.println () --> print it but the cursor is now on the next line System.out.printf () format your output --> https://www.baeldung.com/java-printstream-printf
24th Feb 2019, 4:00 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
In most programming languages, printf is generally a more formatted output.
24th Feb 2019, 2:48 PM
Mike
Mike - avatar