Question 83 / 90:  What can be said about the following code?
public interface Audible {...}

public class Stereo implements Audible {...}

public class Computer implements Audible {...}

public class AudioSource() {

public void startPlaying(Audible sound) {...}

}

A  Audible is the base class for the Stereo and Computer classes.
B  The startPlaying code should be changed so it uses polymorphism.
C  Object is not a base class for the AudioSource class.
D  The startPlaying method is using the design principle of “programming to an interface.”
<< First < Previous Next > Last >>
Explanation:

D. This is an example of programming to an interface.

The startPlaying method will except as an argument any object that implements that Audible interface.

A, B, and C are incorrect.

A is incorrect because Audible is an interface, not a class.

B is incorrect because this example is already using polymorphism.

C is incorrect because Object is the implied base class for all objects.

Exam Home Page
https://www.jobilize.com/quiz-my-oca-mock-exam-by-mike-wolf

My OCA Mock

Author:

Access: Public Instant Grading

Ask
Madison Christian
Start Exam
Copy and paste the following HTML code into your website or blog.
<iframe src="https://www.jobilize.com/embed/quiz-my-oca-mock-exam-by-mike-wolf" width="600" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" style="border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>