Java Inner Classes are classes defined within another class. They help logically group classes that are only used in one place, improve encapsulation, and can access members of their outer class — even private ones.
Time limit: 0
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Which of the following is NOT a type of inner class in Java?
Correct
Incorrect
Question 3 of 15
3. Question
Can a non-static inner class access private members of the outer class?
Correct
Incorrect
Question 4 of 15
4. Question
Which keyword is used to reference the outer class from an inner class?
Correct
Incorrect
Question 5 of 15
5. Question
Which inner class is defined inside a method?
Correct
Incorrect
Question 6 of 15
6. Question
What is a static nested class?
Correct
Incorrect
Question 7 of 15
7. Question
Can a local inner class access non-final local variables in Java 7?
Correct
Incorrect
Question 8 of 15
8. Question
What is an anonymous inner class?
Correct
Incorrect
Question 9 of 15
9. Question
How is an instance of a member inner class created?
Correct
Incorrect
Question 10 of 15
10. Question
Can an anonymous inner class extend a class and implement an interface at the same time?
Correct
Incorrect
Question 11 of 15
11. Question
What is true about static nested classes?
Correct
Incorrect
Question 12 of 15
12. Question
Which of these is a valid use case for an anonymous inner class?
Correct
Incorrect
Question 13 of 15
13. Question
Which of the following is a correct syntax to define an anonymous inner class?
Runnable r = new Runnable() { public void run() { System.out.println(“Running”); } };
Correct
Incorrect
Question 14 of 15
14. Question
Can a method-local inner class be declared as static?
Correct
Incorrect
Question 15 of 15
15. Question
What is the visibility of inner classes in Java by default?
Correct
Incorrect
Summary
Java Inner Classes help in logically grouping classes that are used only within the outer class. They include member inner classes, static nested classes, local inner classes, and anonymous inner classes, enhancing code organization and encapsulation.
At QuizOrbit, our team specializes in fun, informative quizzes across topics like general knowledge, technology, and entertainment. Boost your knowledge with our expert-designed quizzes.