Skip to content

Instantly share code, notes, and snippets.

@dhust
Created January 19, 2017 17:17
Show Gist options
  • Save dhust/122ac00e9d6ea3786655ce02d0c0f5a0 to your computer and use it in GitHub Desktop.
Save dhust/122ac00e9d6ea3786655ce02d0c0f5a0 to your computer and use it in GitHub Desktop.
This is a Parent super class. It will be extended by an Employee class.
public class Person {
// Fields or Instance variables
private String name;
private int age;
private boolean isFemale;
// Default contructor
public Person () {
name = "Steve";
age = 20;
isFemale = false;
}
// Constructor with arguments
public Person (String theName, int theAge, boolean isFemale) {
name = theName;
age = theAge;
this.isFemale = isFemale;
}
/**
* @return the person's name
*/
public String getName() {
return name;
}
/**
* @param name sets the person's name
*/
public void setName(String name) {
this.name = name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment