Answered
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
On Jul 24, 2024