A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
System.out.println Special Characters
Joined: Nov 11, 2004
Nov 21, 2004 05:51:00
Does the command System.out.println have any special functions which enter tabs into the stream or anything like that? Features which would improve the formatting of the console output?
For instance I have multiple lines and wish for the information to be displayed like so..
Report xyz calculates currency exchange �-$ = $120
Report xyz calculates oil price rise to be = $110/day
Etc etc so the equals column is always level
author and iconoclast
Joined: Jul 08, 2003
Nov 21, 2004 07:10:00
You can embed a tab in a
using the escape sequence \t -- i.e.,
prints a tab character.
[Jess in Action]
Joined: Mar 13, 2004
Nov 21, 2004 07:15:00
System.out.println( "oil price" + '\t' + "$50" );
System.out.println( "wine price" + '\t' + "$60" );
Be aware that the number of spaces between tabs could be 5, so hitting the same tab to align columns requires a bit of planning.
SCJP 1.4, SCWCD in process
I agree. Here's the link:
subject: System.out.println Special Characters
Question on inheritence
URGENT : Thread Problems
columnClasses in HtmlDataTable
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013