| Author |
System.out.print questions
|
Richard Chambers
Ranch Hand
Joined: Apr 03, 2008
Posts: 40
|
|
I know this is beyond basic, but here goes. We've studied ONLY the System.out.print methods of displaying output, so I'll have to use one of those, I know there are other better ways. My formatted output will look similar to a spreadsheet. It will have 10 columns spanning 105 spaces. I'm planning on using printf my question has to do with cell spacing We've done things like the $%10.2f for money, is there a limit to my width? or in other words, is %30s a valid entry? also, how do I adjust my console window to display the 105 spacing, currently my trial runs are truncating. just checking before I type it in a few hundred times in the actual coding Thanks
|
 |
marc weber
Sheriff
Joined: Aug 31, 2004
Posts: 11343
|
|
Originally posted by Richard Chambers: ...how do I adjust my console window to display the 105 spacing, currently my trial runs are truncating...
On a Windows Command Prompt in XP, you can right-click on the title bar, then select "Defaults" or "Properties." On the "Layout" tab, you can set the screen buffer size (the "actual" size of the console) and the window size (the scrolling frame that you're using to view the console).
|
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
|
 |
Katrina Owen
Sheriff
Joined: Nov 03, 2006
Posts: 1336
|
|
Originally posted by Richard Chambers: just checking before I type it in a few hundred times in the actual coding
On a side note, rather than type it in a few hundred times, you might want to create a little utility method which formats whatever you put into it however you want it. Not sure what you're typing, of course, but it is usually a good idea to be lazy about duplication. I've heard it stated something like this: the first time you write it, just write it. the second time you write it, go ahead and write it, or copy and paste it and tweak it to what you need. the third time you write it, abstract it into a method and replace the two previous instances with your new method.
|
 |
 |
|
|
subject: System.out.print questions
|
|
|