Click here to Skip to main content
16,004,887 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to print the output in next line

Lit
5.55
Mil
6.77

What I have tried:

System.out.printf("lit %.2f \n", l);
System.out.printf("mil %.2f \n", m);
Posted
Updated 30-Jan-20 2:46am

1 solution

The character which codes for next line is \n.
So
Java
System.out.printf("lit\n%.2f\n", l);
System.out.printf("mil\n%.2f\n", m);
should give you proper format.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900