Search Interview Questions
| 3361 questions in repository.|
There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Have a video suggestion.
Click Correct / Improve and please let us know.
|Java - Interview Questions and Answers|
|Ans. The accessibility (public, protected, etc.) of the inner class is defined by the outer class. |
Just like top-level classes, an inner class can extend a class or can implement interfaces.
Similarly, an inner class can be extended by other classes, and an inner interface can be implemented or extended by other classes or interfaces.
An inner class can be declared final or abstract.Inner classes can have inner classes, but you will have a hard time reading or understanding such complex nesting of classes.
|Help us improve. Please let us know the company, where you were asked this question :|
|Like Discuss Correct / Improve  java   oops   classes   inner classes Asked in 2 Companies Basic   frequent|
Try 2 Question(s) Test
|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 are the different types of inner classes ?|
|What is the difference between inner class and sub class ?|
|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 ?|