1.

What are local classes?(a) Classes declared inside a package(b) Classes declared inside a function(c) Classes declared inside a class(d) Classes declared inside structureThis question was posed to me in an internship interview.I would like to ask this question from Local Class topic in portion Class Members & Types of Object Oriented Programming

Answer»

The correct option is (b) CLASSES DECLARED inside a function

The EXPLANATION: The classes declared inside a package are available to all the functions and classes, HENCE can’t be called local. This is somewhat similar concept that we use to denote variables of a function. The classes declared inside functions will be local to them.



Discussion

No Comment Found

Related InterviewSolutions