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
Get step-by-step solutions from verified subject matter experts
