Skip to content

Instantly share code, notes, and snippets.

@dhust
Last active January 19, 2017 20:35
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 dhust/418e37ca52822a0e05799ad2fc4d2062 to your computer and use it in GitHub Desktop.
Save dhust/418e37ca52822a0e05799ad2fc4d2062 to your computer and use it in GitHub Desktop.
This class is testing the Person super class and the Employee subclass.
public class Testing {
public static void main(String[] args) {
Person steve = new Person();
steve.info();
Person jessica = new Person("Jessica", 23, true);
jessica.info();
Employee rich = new Employee("Rich", 40, false); // constructors are never inherited
rich.info(); // can use this method because it's inherited from the Person class
Employee sam = new Employee(); // not inherited
sam.setName("Sam"); // inherited
sam.info(); // inherited
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment