TYPES OF METHODS :
METHOD OVERLOADING :
Same function name but different parameters (num ,type & order ) or return type. In below class shape the method area is overloaded.
class shape....
{
display area()
{system.out.println (''area'' = +0) ; }
display area(int s )
{display.out.println (s * s) ;}
display area(int w, int h)
{w * h ; }
display area(int r , float deg)
{pi * r * r ;}
}
METHOD OVERRIDING
both func must be exactly same (parameter & return type)...
class shape
{
display area( ) {}
}
class square extends shape
{
display area( ) {}
}
here the display area function of child class (square) has overrided the display area func of parent class(shape)..
all rights reseverd by Cramerz.com©. web development by
web design company
DotPeak. hosting by HostBay
all contents on cramerz are the property of Cramerz.com. web design courses