Access over 20 million homework & study documents

Java programmers can use class hierarchies for the purposes of inheritance.

Content type
User Generated
Subject
Computer Science
Type
Homework
Rating
Showing Page:
1/6

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/6

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/6

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 6 pages?
Access Now
Unformatted Attachment Preview
/** * Created by e7006722 on 4/07/2014. */ public class Animal { private String name; @Override public String toString() { return "Animal{" + "name='" + name + '\'' + '}'; } public Animal() { } public Animal(String name) { this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } } /** * Created by e7006722 on 4/07/2014. */ public class Mammal extends Animal { private String habitat; public Mammal() { } public Mammal(String habitat) { this.habitat = habitat; } public Mammal(String name, String habitat) { super(name); this.habitat = habitat; } @Override public String toString() { return "Mammal{" + "habitat='" + habitat + '\'' + '}'; } public String getHabitat() { return habitat; } public void setHabitat(String habitat) { this.habitat = habitat; } public void nurse() { System.out.println("Called the Mammal.nurse method"); } } /** * Created by e7006722 on 4/07/2014. */ public class Oviparous extends Animal { private String dwelling; @Override public String toString() { return "Oviparous{" + "dwelling='" + dwellin ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Just what I needed…Fantastic!

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4