- THE MAIN PURPOSE OF METHOD OVERRIDING CAN BE TO PROVIDE SPECIFIC IMPLEMENTATION OF A METHOD I.E ALREADY PROVIDED BY SUPER CLASS
- IT WILL ONLY POSSIBLE WHEN INHERITENCE IS PRESENT
EX
class Rectangle
{
void draw(int x,int y)
{
System.out.println("this is sharp rectangle with edges" +x+"&"+y);
}
class Roundrect extends Rectangle
{
void draw(int x,int y)
{
System.out.println("this is round rectangle with edges" +x+"&"+y)
}
class Override
{
public static void main(String args[])
{
Roundrect rr=new Roundrect();
rr.draw(10,20);
}
}