Given: 1. interface Syrupable { 2. void getSugary(); } 3. abstract class Pancake implements Syrupable { } 4. 5. class BlueberryPancake implements Pancake { 6. public void getSugary() { ; } } 7. class SourdoughBlueberryPancake extends BlueberryPancake { 8. void getSugary(int s) { ; } } Which are true? (Choose all that apply.) A. Compilation succeeds. B. Compilation fails due to an error on line 2. C. Compilation fails due to an error on line 4. D. Compilation fails due to an error on line 6. E. Compilation fails due to an error on line 7. F. Compilation fails due to an error on line 9. G. Compilation fails due to an error on line 10.
Added by Michael A.
Step 1
The interface Syrupable is defined correctly with a method getSugary(). Show more…
Show all steps
Your feedback will help us improve your experience
Madhur L and 58 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Look at the code below. You have four classes (O, X, T, and M) and a variable of each of these. O o; X x; T t; M m; The following assignments are all legal (assume that they all compile) m = t; m = x; o = t; The following assignments are all illegal (they cause compiler errors) o = m; o = x; x = o; What can you say about the relationships of these classes? A. O is a superclass and T, M, and X are subclasses B. X is a superclass and M, O, and T are subclasses C. M is a superclass and O, T, and X are subclasses. D. T is a superclass and M, O, and X are subclasses
Akash M.
Use the declarations below for Questions. Here is a program that prints the volume of a solid: Which is a true statement about this program? (A) It will output the volume of the sphere or box, as intended. (B) It will output the volume of the default Solid s, which is neither a sphere nor a box. (C) A ClasscastException will be thrown. (D) A compile-time error will occur because there is no implementation code for volume in the Solid class. (E) A run-time error will occur because of parameter type mismatch in the method call printVolume(sol).
A certain interface provided by a Java package contains just a single method: A programmer adds some functionality to this interface by adding another abstract method to it, method2: As a result of this addition, which of the following is true? (A) A ClassCastException will occur if ob1 and ob2 are not compatible. (B) All classes that implement the original SomeName interface will need to be rewritten because they no longer implement SomeName. (C) A class that implements the original SomeName interface will need to modify its declaration as follows: (D) SomeName will need to be changed to an abstract class and provide implementation code for method2, so that the original and upgraded versions of SomeName are compatible. (E) Any new class that implements the upgraded version of SomeName will not compile.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD