What is a local class?
Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.
What is a local class?
Rating:
A named inner class that is declared within the body of a method is called a local class. A local class is not a member of any class. An inner class declared inside a method is private to the method. Therefore, it can neither be marked with an access modifier (public, private, or protected) nor with the static modifier.
A local class can access only those local variables or parameters in its enclosing method that are declared final. However, it can freely access any other variables (i.e., instance variables or static variables) in its enclosing class.
Rating:
Was this information helpful?
Other articles
- What is an enumeration?
- What is the longValue() method?
- What is a try block?
- What is a JAR file?
- What are numeric promotions?