Created
June 16, 2017 10:44
-
-
Save MericBERBER/09563e5498fa486dfb977368d9a28f85 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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