Java Literals in Hindi
Definition of Java Literals:- A Constant value which can be assign to the variable is called “Java Literals”.
Int x =10;
Where , int indicates java datatype/java keyword
x indicates java variable/ java identifies
10 indicates constant value/java Literals
Integral Literals:- For the integral datatype(byte,short,int,long) these are useful to specify literal value.
Decimal Literals:- Allowed digits are 0 to 9
Syntax: int x = 10;
Octal Literals:– allowed digits are 0 to 7
Syntax: int x = 010;
Hexadecimal literals:– allowed digit are 0 to 9, a to f and A to F
For extra digit we can also use both uppercase and lowercase
This is possible in very few places where java is not case sensitive.
Literals value should be predefined with 0x or 0X.
Int g = 0x10;
Int g = 0X10;