Professional Documents
Culture Documents
1.
2.
3.
4.
5.
6.
7.
Compilation
Javac Compiler
Interpretation
JVM
int
short
byte
(-128
to 127)
long
16
(-32,768
to 32,767)
32
float
32
Character
Primitve :
char
(0
16
to 65,535)
64
double
64
Note :
float val = 32.4f
'f' needs to specified to declare a float, cz Java thinks anything with
a decimal point to be a double, unless 'f' is specified.
Int x = 20;
byte b = x;
// won't work
Although 20 is small enough to fit into a byte, the compiler only
sees the instruction as a 'larger' integer value trying to transfer
into a 'smaller' byte. Compiler doesn't consider the value '20'.
Compiler will not put value from a large cup(var) to a small one, but
allows from small to large.
Object Reference :