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
Q21: An interface is a class that contains
Q22: Interfaces are defined using the reserved word
Q33: Suppose there are three classes named Shape,
Q34: Which of the following statements about the
Q35: Inheritance is an example of what type
Q40: An abstract method is a method that
Q41: Composition is also called _.
A) inheritance
B) aggregation
C)
Q43: The method toString() is a public member
Q44: Which operator is used to determine if
Q47: If a class implements an interface, it
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents