Question: Step 1 : Define the Interface SoundMaker 1 . Create an interface called SoundMaker. 2 . In the SoundMaker interface, define the following method signature:
Step : Define the Interface SoundMaker
Create an interface called SoundMaker.
In the SoundMaker interface, define the following method signature:
void makeSound;
This interface will be used to enforce that all animals must have a makeSound
method.
Step : Define the Abstract Base Class Animal
Create an abstract class called Animal that implements the SoundMaker interface.
Fields:
a Create a static classlevel variable numberOfAnimals to track the total
number of animals created.
static int numberOfAnimals ;
b Create a nonstatic field name of type String to store the name of the animal.
Constructors:
a Implement a default constructor that:
o Increments the numberOfAnimals by
o Prints "Animal Constructor called"
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
