/** Program: EssentialLiterals Purpose: simple demonstration of Java data literals. @author john@december.com @version 1.00; 21 July 1995 */ class EssentialLiterals { public static void main (String args[]) { System.out.println("INTEGER (BASE 10)"); System.out.println(10); // This is a base 10 integer System.out.println(4294967295); // large 32 bit integer (int) System.out.println(9223372036854775807L); // large 64 bit integer (L on end = long) System.out.println(2E3); // scientific notation: 2 times 1,000 System.out.println("INTEGERS IN OTHER BASES"); System.out.println(010); // A leading 0 means octal (base 8) System.out.println(0x10); // A leading 0x means hexidicemal (base 16) System.out.println("BASE 16"); System.out.println(0xA); // A in base 16 is the digit for 10 System.out.println(0xB); // B in base 16 is the digit for 11 System.out.println(0xC); // C in base 16 is the digit for 12 System.out.println(0xD); // D in base 16 is the digit for 13 System.out.println(0xE); // E in base 16 is the digit for 14 System.out.println(0xF); // F in base 16 is the digit for 15 System.out.println("BOOLEAN"); System.out.println(true); System.out.println(false); System.out.println("FLOATING POINT"); System.out.println(3.1415); // real number System.out.println(-0.61803); // negative real number System.out.println(2.9E4); // scientific notation: 2.9 times 10,000 System.out.println("STRINGS"); System.out.println(""); // empty string System.out.println("\"Hi, Lorrie.\""); // quote in string System.out.println("one\ntwo"); // linebreak in string System.out.println("hot\tjava"); // tab in string } }