A subclass of Value, LargerValue, is defined with a getValue method that returns twice the value of the parent. Which line is the body of LargerValue's getValue method?A. return super.number * 2; B. return super.getValue()*2;C. return number * 2;D. return getValue() *2;

Respuesta :

Return super.getValue()*2 is the body of LargerValue's getValue method.

Option: (B)

Explanation:

The class value is partially defined below,

Public class value  

{

Private int number;

Public int value()

{

Return number;

}

}

The LargerValue and subclass of Value is defined with a getValue method that returns twice the value of the parent. “return super.getValue()*2” is the body of LargerValue's getValue method. The ‘Java HttpCookie class’ of the getValue()method is used to return the current value of the cookie.

Syntax:

public String getValue()  

Thus method is used to return a ‘String’ which contains the current value of the cookie.