Multiple Choice
Consider the following class definitions. public class BClass {private int x; public void set(int a) { x = a; } public void print() { }} public class DClass extends BClass {private int y; public void set(int a, int b) {//Postcondition: x = a; y = b;} public void print() { }} Which of the following is the correct definition of the method set of the class DClass? (i) public void set(int a, int b) {super.set(a) ; y = b;} (ii) public void set(int a, int b) {x = a; y = b;}
A) Only (i)
B) Only (ii)
C) Both (i) and (ii)
D) None of these
Correct Answer:

Verified
Correct Answer:
Verified
Q25: An interface is a class that contains
Q26: Redefining a method of a superclass is
Q27: Suppose that the class Mystery is derived
Q28: Java uses late binding for methods that
Q29: Which of the following statements about the
Q31: Inheritance implies an "is-a" relationship.
Q32: Inheritance is an example of what type
Q33: Consider the following class definitions. public class
Q34: Which operator is used to determine if
Q35: Composition is also called _.<br>A) inheritance<br>B) aggregation<br>C)