Use printf In java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Use printf In java

How to use printf function in Java

26th Jan 2018, 2:54 PM
Amrit Sahani
Amrit Sahani - avatar
1 Answer
+ 1
It's System.out.printf The formatting for strings is %s, and for newlines it's %n so if you wanna print a string followed by a newline: String foo = "Hello World"; System.out.printf("%s%n", foo); Here is a quick reference for printf: https://www.scribd.com/document/230202987/Java-Printf-Method-Quick-Reference
26th Jan 2018, 3:11 PM
SplittyDev
SplittyDev - avatar