Question: Implement the Speaker interface and create 3 classes(Dog, Cat, Philosopher) that implement Speaker in various ways (in addition to overriding methods, each class should add
Implement the Speaker interface and create 3 classes(Dog, Cat, Philosopher) that implement Speaker in various ways (in addition to overriding methods, each class should add an additional method).
public interface Speaker
{
public void speak();
public void announce(String str);
}
Create a driver class - TestSpeaker.java - whose main method instantiates each of the 3 classes and tests their abilities using the same Speaker reference. Then try to execute all methods from each class (using different reference types).
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
