1Literals are number, text, or anything that represent a value.
2In other words, Literals in Java are the constant values
3assigned to the variable.
4It is also called as constants........
1public class Test {
2 public static void main(String[] args)
3 {
4 int a = 101; // decimal-form literal
5 int b = 0100; // octal-form literal
6 int c = 0xFace; // Hexa-decimal form literal
7 int d = 0b1111; // Binary literal
8 System.out.println(a);
9 System.out.println(b);
10 System.out.println(c);
11 System.out.println(d);
12 }
13}
1public class Test {
2 public static void main(String[] args)
3 {
4 int a = 101; // decimal-form literal
5 int b = 0100; // octal-form literal
6 int c = 0xFace; // Hexa-decimal form literal
7 int d = 0b1111; // Binary literal
8 System.out.println(a);
9 System.out.println(b);
10 System.out.println(c);
11 System.out.println(d);
12 }
13}