Question: Q 9 . Consider the Java interface defined below. According to this definition, if a class declares that it is Printable, then it must implement

Q9. Consider the Java interface defined below. According to this definition, if a class declares that it is Printable, then it must implement a print() method. public interface Printable { void print(); } Write two simple classes Test1 and Test2 which implement the Printable interface. Q10. Using your Test1 and Test2 classes of Q9, implement a method in a new test class, void printAll(Printable printables[]) which takes an array of Printable references and calls print() on e XM06 ach reference in the array. The array passed in to printAll should be composed of a mixture of Test1 and Test2 objects.

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 Programming Questions!