Skip to content

Instantly share code, notes, and snippets.

@MericBERBER
Created June 16, 2017 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MericBERBER/09563e5498fa486dfb977368d9a28f85 to your computer and use it in GitHub Desktop.
Save MericBERBER/09563e5498fa486dfb977368d9a28f85 to your computer and use it in GitHub Desktop.
// 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