Java Data Types in Hindi
“Java Data types is a spacial keyword used to allocate sufficient memory space for the data, in other words Java Data types is used for representing the data in main memory (RAM) of the computer”
In general every programming language is containing three categories of data types. They are
Fundamental or primitive data types
Derived data types
User defined data types
to represent numbers. Primitive Data types:-
There are two types of primitive data type in Java
byte,short,int,long Integral Datatype:-
float,double Floating-Point Datatype:-
– to represent characters. For Example, char JavaGuide Char Datatype :
– to represent logical value. For Example , boolean true Boolean Datatype:
Java Data types in Hindi, Core Java Tutorials in Hindi, Best Core Java Guide in Hindi
Integral Data Types in Java
1) :- byte
size:- 8 bits 1 byte
Maximum Value:- 127
Minimum Value:- -128
Range:- -128 to 127
most significant bit is called “ sign bit”. 0 means +tive value and 1 means –tive value.
byte g = 117; //right
byte g = 127; //right
byte g = 131; //wrong compile time error
byte g = 127.89; //wrong compile time error
byte g = true; //wrong compile time error
byte g = ”JavaGuide”; //wrong compile time error
2) short :-
rarely used data type in java is short.
This data type is best For
16 bit processor.
Now a days
16 bit processor outdated & hence short data type is also outdated.
range:- [-32768 to 32767] -2
15 to 2 15-1
short g = 32767; //right
short g = -32767; //right
short g = 32768; //wrong compile time error
short g = 123.456; //wrong compile time error
short g = true; //wrong compile time error
3) int :-
most commonly used data type is int.
C – Language data type varied from platform to platform.
Means for 16 bit processor it is 2 bytes and 32 bit processor it is 4 bytes.
Advantage:- This approach will helpful for read & write purpose.
Disadvantage:-chances of failing program very high.
Size:- 4 bytes
Range:- [-2147483648 to 2147483647] -2
31 to 2 31-1
But in java language size will be 4 bytes for any platform.
Advantage:- Chances of
failing program is very less. Because java is robust language.
read & write operation will become costly & performance will be reduced.
4) – long:
data type is not enough to hold . big value that time we should go for long data type
To represent big value like lacks and corer value.
Size:- 8 bytes
63 to 2 63-1
Note:- All above data types ment for representing
For represent real number compulsory we should go for floating point data type.
1) :- float
38 to 3.4e 38
5 to 6 decimal place accuracy we should go for float.
2) :- Double
308 to 1.7e 308
14 to 15 decimal place we should go for double.
Go4Vidhya- you may like to check
Features of Java in Hindi