← Quiz: Nested and Anonymous Classes: all 10 questions
Quiz: Nested and Anonymous Classes · Question 9 of 10
Where can a local class be used?
Where can a local class be used?
- A.Anywhere in the package
- B.Anywhere in the outer class
- C.Only in subclasses
- D.Only inside the method (block) where it is declared
Answer & explanation
Correct answer: Only inside the method (block) where it is declared
A local class is scoped like a local variable.
Can you get the rest right without peeking?
Take the timed Quiz: Nested and Anonymous Classes quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →