1.

Use of nested class ____________ encapsulation.(a) Increases(b) Decreases(c) Doesn’t affect(d) Slightly decreasesI have been asked this question in an interview for job.Enquiry is from Nested Class in chapter Class Members & Types of Object Oriented Programming

Answer» RIGHT option is (a) Increases

To EXPLAIN I would say: The use of nested class increases encapsulation as the inner class is GETTING EVEN more grouped into the enclosing class. Firstly the class encapsulate the data, having nested classes can increase the encapsulation even further.


Discussion

No Comment Found

Related InterviewSolutions