Friday, 10 May 2013

Java Tab Character

You can use \t to tab across in Java. Tab positions appear to be every 8 characters on the UNIX system below:

UNIX > cat prog25.java
public class prog25
{
public static void main (String args[])
  {
  System.out.println("         1         2");
  System.out.println("12345678901234567890");
  System.out.println("Andrew\tReid");
  System.out.println("Andrew\t\tReid");
  }
}
UNIX > javac prog25.java
UNIX > java prog25
         1         2
12345678901234567890
Andrew  Reid
Andrew          Reid
UNIX >

If you have a Java book on Amazon, which you would like to advertise here for free, please write to me at international_dba@yahoo.co.uk.