Search Interview Questions
| More than 3000 questions in repository.|
There are more than 900 unanswered questions.
Click here and help us by providing the answer.
Have a video suggestion.
Click Correct / Improve and please let us know.
|Core Java - Interview Questions and Answers for 'Method local inner classes' - 1 question(s) found - Order By Newest|
|Ans. You can create a non-static local class inside a body of code. Interfaces cannot have local classes, and you cannot create local interfaces.|
Local classes are accessible only from the body of the code in which the class is defined. The local classes are completely inaccessible outside the body of the code in which the class is defined.
You can extend a class or implement interfaces while defining a local class.
A local class can access all the variables available in the body of the code in which it is defined. You can pass only final variables to a local inner class.
|Help us improve. Please let us know the company, where you were asked this question :|
|Like Discuss Correct / Improve  java   oops   inner classes   local classes   classes   method local inner classes Asked in 1 Companies|
|Why do we need Inner classes ? Cant we just work with outer classes wherever we implement Inner classes ?|
| What is the difference between the following two code lines ?|
1. new OuterClass().new InnerClass();
2. new OuterClass.InnerClass();
|What is the difference between inner class and sub class ?|
|What are the different types of inner classes ?|
|Which access specifier can be used with Class ?|
|Difference between nested and inner classes ?|
|Which of the following cannot be marked static ?|
|Explain use of nested or inner classes ?|
|What is the benefit of inner / nested classes ?|
|Explain Static nested Classes ?|