Last active
February 2, 2022 16:39
-
-
Save FelicePollano/901970b3625cf0e516f31495cbba6c46 to your computer and use it in GitHub Desktop.
Java simple inheritance
This file contains hidden or 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
class Person | |
{ | |
public void sayHello() | |
{ | |
System.out.println("Hello World"); | |
} | |
} | |
class Employee extends Person | |
{ | |
public void sayHello() | |
{ | |
super.sayHello(); | |
} | |
} | |
public class MyClass { | |
public static void main(String args[]) { | |
Employee p = new Employee(); | |
p.sayHello(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment