Problem

Abstract Class vs InterfaceThe following classes are modifications of those in Example 13....

Abstract Class vs Interface

The following classes are modifications of those in Example 13.4. Here, Playable is an abstract class rather than an interface,

   public abstract class Playable   {     public abstract void play();   }

and CD, DVD, and MP3 each extends, rather than implements, Playable.

   public class CD extends Playable   {        // methods for CD   }   public class DVD extends Playable   {        // methods for DVD   }   public class MP3 extends Playable   {        // methods for MP3   }

a. Explain the advantages of designing Playable as an interface rather than as an abstract class.


b. Describe a different example where an interface is clearly preferable to an abstract class.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 13
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT