Two Laptop Bag
The moose likes Java in General and the fly likes Arrange output on prompt Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Arrange output on prompt" Watch "Arrange output on prompt" New topic
Author

Arrange output on prompt

adeeb alexander
Ranch Hand

Joined: May 29, 2008
Posts: 267
Hi all.
Look at the out put of the given program below

Program:



Output:
ferrari ferrari
mclaren mclaren
lamborghini lamborghini
All are A class cars All are A class cars
Fiat Fiat



I am getting the out put in a mixed up manner. Is there any way so the i can arrange the output in column format. Some what all String a elements in first column and String b elements in other column.

Thanks and Regards
alexander
>
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
Look at the Formatter class, or String.format(...) or System.out.printf(...). The second two guys are based on Formatter and obey its rules.

e.g.,
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Arrange output on prompt
 
Similar Threads
constructor
TreeSet not allowing the addition of a unique object, yet the equals() method is not being called
Anonymous Inner Class Problem
problem with tomcat embedded application
need read a word of my project . Need help!!!