Header Ads Widget

WAP to Show operator overriding in java.

 Code:-


class Base
{
public void print()
{
System.out.println("This is a base class");
}
}

class child extends Base
{
public void print()
{
System.out.println("This is child class");
}
}

class overriding
{
public static void main(String[] args)
{
child obj=new child();
obj.print();
}
}

Output:-

This is child class


Recommended Post:

Full C course:-    

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-