Java Literals in Hindi- What are Java Literals?, Why We use Java Literals

0
242
views
Java Literals in Hindi, Core Java Guide, Core Java Tutorials, Core Java Guide in Hindi
Java Literals in Hindi, Core Java Guide, Core Java Tutorials, Core Java Guide in Hindi

Java Literals in Hindi

Definition of Java Literals:- A Constant value which can be assign to the variable is called “Java Literals”.

Syntax:

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.

Java Literals, Core Java Tutorials, Core Java Guide in Hindi
Java Literals, Core Java Tutorials, Core Java Guide in Hindi

Decimal Literals

Decimal Literals:- Allowed digits are 0 to 9

Syntax: int x = 10;

Octal Literals

Octal Literals:allowed digits are 0 to 7

Syntax: int x = 010;

Hexadecimal literals

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;

LEAVE A REPLY

Please enter your comment!
Please enter your name here