Which of the following could not be used to implement getLastPlusInitial()?
a. return (lastName + ", " + firstName.substring(0, 1) + ".");
b. return (getLastName + ", " + getFirstName.substring(0, 1) + ".");
c. return (getLastName() + ", " + getFirstName().substring(0, 1) + ".");

Respuesta :

tanoli

Answer:

b)

Explanation:

in section b) we can see that we don't have parenthesis at the end of every getter method call. for example we have a getter method for lastName as getLastName() but in return statement we don't call the getter method with parenthesis, that will cause compile time error.