Dylan Kelemen Dylan Kelemen - 1 month ago 5
Java Question

How to get LONG print line statements to "spill" onto next line without causing compile error in Java?

Essentially my System.out.printf statement is too long. Rather then cutting some of it off and adding another printf statement is there any way to get it to go to the next line without causing a compile error. My code is as follows

System.out.printf("%3d%9s%3d%5s%3d%4s", array[i],"ounces =", pounds, "lbs,", remainder, "oz.);


I tried doing something like

System.out.printf("%3d%9s%3d%5s%3d%4s", array[i],"ounces =",
+ pounds, "lbs,", remainder, "oz.);


but that did not work. Any help would be greatly appreciated!

Answer
System.out.printf("%3d%9s%3d%5s%3d%4s",
 array[i],"ounces =",
 pounds, "lbs,",
 remainder, "oz");

what problems?