Why I Use printf keyword in Java Programming??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Why I Use printf keyword in Java Programming???

When I want to see array index then I use System.out.printf(); Because we are always use System.out.println();

24th Feb 2019, 1:57 PM
Nasir❤
Nasir❤ - avatar
1 Answer
+ 5
I guess printf is not a keyword It's a function (method) It's used in java so that we get C like printf and also because you can use format specifier for precision etc Like System.out.printf("Formatted with precison: PI = %.2f\n", Math.PI); https://www.google.com/amp/s/www.geeksforgeeks.org/formatted-output-in-java/amp/
24th Feb 2019, 3:03 PM
Rstar
Rstar - avatar