TYPES OF METHODS :
- Class Methods : which s for class e,g Box.info
- Instance Methods :which s created wth each obj e,g b1.info , b2.info
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)..