Skip to content

Instantly share code, notes, and snippets.

@FelicePollano
Last active February 2, 2022 16:39
Show Gist options
  • Save FelicePollano/901970b3625cf0e516f31495cbba6c46 to your computer and use it in GitHub Desktop.
Save FelicePollano/901970b3625cf0e516f31495cbba6c46 to your computer and use it in GitHub Desktop.
Java simple inheritance
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