What this line do? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What this line do?

System.out.println("%-15s%03d%n",s1,x);

3rd Jun 2017, 8:04 AM
gogamid
4 Answers
+ 4
The compiler throws an error.
3rd Jun 2017, 8:25 AM
Vishnu ks
Vishnu ks - avatar
+ 1
The println syntax firstly doesn't allow to make such a formated print. that's the printf syntax. for exem: Whith PRINTF | 1 String name= "Ben"; | 2 System.out.printf("good morning %s ", name); But with PRINTLN | 1 String name = "Ben"; | 2 System.out.println("good morning " + name); So that line will do nothing good
3rd Jun 2017, 8:38 AM
BenjiSolo
BenjiSolo - avatar
0
Nothing println should be printf
3rd Jun 2017, 8:56 AM
Rachit Tripathi 😘
Rachit Tripathi 😘 - avatar
0
Oh sorry, I mean printf. What are the symbols mean?
3rd Jun 2017, 8:58 AM
gogamid