1.

Which function among the following can’t be accessed outside the class in java in same package?(a) public void show()(b) void show()(c) protected show()(d) static void show()I have been asked this question in exam.I need to ask this question from Private Member Functions in division Member Functions & its Types of Object Oriented Programming

Answer»

The CORRECT OPTION is (c) protected SHOW()

For explanation: The protected members are available within the CLASS. And are also available in DERIVED classes. But these members are treated as private members for outside the class and inheritance structure. Hence can’t be accessed.



Discussion

No Comment Found

Related InterviewSolutions