Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Fixed tab position in Java

843785Oct 28 2008 — edited Nov 3 2008
Hi.

I wonder if it is possible to make a fixed tab (tabulator) in Java in order to print text in straight columns.

In the example below I sometimes need to use one Java-tab and sometimes two in order to make two straight columns. But if a new animal is added, I don't know what number of tabs I need to add!
System.out.println("Ape" + "\t\t" + "Brown")
System.out.println("Pig" + "\t\t" + "Pink")
System.out.println("Hippopotamous" + "\t" + "Grey")
System.out.println("Hummingbird" + "\t" + "Unknown color")
Edited by: suladna on Oct 28, 2008 11:27 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 1 2008
Added on Oct 28 2008
10 comments
504 views