Program to demonstrate Literal usage in Java
public class LiteralsInfo { public static void main(String[] args) { byte b1 = 127; byte b2 = 128; // Compilation Error short s1 = 32767; short s2 = 32768; // Compilation Error int i1 = 2147483647; int i2 = 2147483648; // Compilation Error int i3 = 0x1f; // For Hexadecimal numbers int i4 = 0x1F; // For Hexadecimal numbers int i5 = 0176; long n1 = 300L; // long suffix long n2 = 300l; // long suffix long n3 = 300; float f1 = 3; float f2 = 3F; // float suffix float f3 = 3f; // float suffix double d1 = 1d; // double suffix double d2 = 1D; // double suffix char c = 'a'; } }