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