Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

O A https://bcinstructure.com/courses/1653813/quizzes/3556143/take Consider the

ID: 3916993 • Letter: O

Question

O A https://bcinstructure.com/courses/1653813/quizzes/3556143/take Consider the following class definitions. public class BClass t private int x public void set(int a) ( xa; public void print y public class DClass extends BClass private Int y public void set (int a, int b) //Postcondition: x a;y b; cwhot goes here?> public void print(x ) which of the following is the best definition of the set) method of the class Dclass, according to our suidelines? public void set (int a, int b) ( super.set (a) public void set (int a, int b) t y -bi ch

Explanation / Answer

SOLUTION:- (i) is correct

public void set(int a, int b)

{

    super.set(a);

    y = b;

}

Explanation:- Because the declaration of x is private in super class "Bclass" so it can not be accessed directly in sub class "Dclass" and method "set" accepts only one argument in super class so it will be overloaded. So we can say that option (i) is correct definition of set() method of the class Dclass.

=============================================================================