+ 2

Can someone explain me this weird looking code??đŸ€”đŸ€”đŸ€”

I can't understand this,"System.out.printf("%-15s%03d%n", s1, x);"piece of code! Scanner sc=new Scanner(System.in); System.out.println("================================"); for(int i=0;i<3;i++) { String s1=sc.next(); int x=sc.nextInt(); System.out.printf("%-15s%03d%n", s1, x); } System.out.println("================================");

3rd Jan 2018, 2:06 AM
Niraj Patidar
Niraj Patidar - avatar
3 Answers
+ 1
thanks but I want to know about this line System.out.printf("%-15s%03d%n", s1, x);
3rd Jan 2018, 8:46 AM
Niraj Patidar
Niraj Patidar - avatar
0
it will print ==, then run a loop 3 times. each time it will take 2 input. one string and one int. then it will print that string and integer. and then again print ===
3rd Jan 2018, 4:15 AM
shobhit
shobhit - avatar
0
expresiones regulares?
8th Jul 2019, 10:39 PM
Ricardo De Angelis
Ricardo De Angelis - avatar