Question: JAVA 23 to 25 pleases 23. Write an abstract class Animal. The Animal class has a name and birth year. It has getters and setters
JAVA
23 to 25 pleases

23. Write an abstract class Animal. The Animal class has a name and birth year. It has getters and setters for the instance variables and a no-arg constructor. It also has an abstract method, speak, which returns a String 24. Write a class Cat which is a subclass of Animal. The Cat class has an additional instance variable, hair-length. Write getters and setters for the Cat class. Write a constructor for the Cat class which takes name, birth year and hair length as parameters and values the instance variables of Cat. It should also override the abstract method of Animal, speak, to return the String, "meow". 25. Create an object of type Cat
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
