Java Data Types

Type Size Initial Value
byte 1  byte 0
short 2  bytes 0
int 4  bytes 0
long 8  bytes 0L
float 4  bytes 0.0f
double 8  bytes 0.0d
char 2  bytes null
Boolean 1 bit false

Type Casting

From To
byte Short,char,int,long,float,double
short Int,long,float,double
char
int Long,float,double
long Float,double
float double

Operators

Special Operators:
            Instanceof Operator:  The instance of operator is an object reference operator and returns true if the object on the left hand side is an instance of the class given on the right hand side, this opearton allows us to determine whether the object belongs to a particular class or not.
Ex: person instanceof student
is true if the object person belongs to the class student ; otherwise it is false.

            Dot Operator :  the dot operator(.) is used to access the instance variables and methods of class objects
Ex: person.x
person.put();

 

For
Online Classes

Contact Us: 9885348743