InterviewSolution
Saved Bookmarks
| 1. |
Which of the following statements are incorrect?(a) public members of class can be accessed by any code in the program(b) private members of class can only be accessed by other members of the class(c) private members of class can be inherited by a subclass, and become protected members in subclass(d) protected members of a class can be inherited by a subclass, and become private members of the subclassThe question was posed to me in unit test.I'm obligated to ask this question of Access Control topic in section Classes and Methods of Java |
|
Answer» CORRECT answer is (c) PRIVATE MEMBERS of class can be inherited by a subclass, and become protected members in subclass Easy explanation: private members of a class can not be inherited by a subclass. |
|