-
Format Java output
I am in my first Java class. My first assignment requires me to offset my output by 25 spaces from the beginning of the line and I have no idea how to do this. I have found System.out.printf and Formatter but do not know if these will do what I need. I have read about both of these but am having trouble figuring them out. Can somebody please help me out?
-
Re: Format Java output
Did you read the API doc for the printf method? It has a link to Format String syntax that explains how to use it.
Also do a Search on the forum for printf to find some code examples.
Then write some sample code to test it out. Try it many different ways to see what the effects of changing this part and that part do to the output.
-
Re: Format Java output