Question: Create a class Animal.java that has data fields name, age, size, and food. Create setters and getters for this class. Next create a subclass Bear.java

Create a class Animal.java that has data fields name, age, size, and food. Create setters and getters for this class. Next create a subclass Bear.java that includes an additional field for isHibernating. Create getters and setters for this class. Last, create another class Shark.java that includes the following new field isInWater. Create a getter and setter for the new field. Create a class AnimalDemo.java that demonstrates each of the classes.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!