Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Animal
- {
- private String gender;
- private int legs;
- private String eyes;
- private int tail;
- public Animal()
- {
- this.gender = "male";
- this.legs = 2;
- this.eyes = "blue";
- this.tail = 0;
- }
- public String getGender()
- {
- return gender;
- }
- public int getLegs()
- {
- return legs;
- }
- public String getEyes()
- {
- return eyes;
- }
- public int getTail()
- {
- return tail;
- }
- public void setGender(String gender)
- {
- this.gender = gender;
- }
- public void setLegs(int legs)
- {
- this.legs = legs;
- }
- public void setEyes(String eyes)
- {
- this.eyes = eyes;
- }
- public void setTail(int tail)
- {
- this.tail = tail;
- }
- public void printDetails()
- {
- System.out.println("Gender: " + gender + "\nLegs: " + legs
- + "\nEyes: " + eyes + "\nTail: " + tail+"\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment