Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
// Base Class
class Parent
{
void show()
{
System.out.println("Parent's show()");
}
}
// Inherited class
class Child extends Parent
{
// This method overrides show() of Parent
void show()
{
super.show();
System.out.println("Child's show()");
}
}
// Driver class
class Main
{
public static void main(String[] args)
{
Parent obj = new Child();
obj.show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment