Last active
January 19, 2017 20:35
-
-
Save dhust/418e37ca52822a0e05799ad2fc4d2062 to your computer and use it in GitHub Desktop.
This class is testing the Person super class and the Employee subclass.
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
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