Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using printf with multiple strings and floats

719965Nov 24 2008 — edited Nov 24 2008
Can somebody please help me with printf? I am trying to format the following:
System.out.printf("t = "+ time +  "  X: " + x +  "  Y: "+ y );
I want to show only 3 decimal points. I tried adding %5.3f%n and changing the plus signs to commas, but that only shows the time and stops. How do I show formatted string, formatted float, formatted string, formatted float?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 22 2008
Added on Nov 24 2008
10 comments
636 views