← All topics
Quiz: static, final and Nested Classes: questions with answers
10 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. What does this print? (code)
- Q2. When does a static block run?
- Q3. What does this print? (code)
- Q4. Which statement about a blank final field is correct?
- Q5. How do you create an object of a (non-static) inner class Account declared inside Bank?
- Q6. Why is a static nested class often preferred over an inner class?
- Q7. A lambda uses a local variable count from its method. What must be true about count?
- Q8. What does this print? (code)
- Q9. Which can an anonymous class do that a lambda cannot?
- Q10. Can a top-level (not nested) class be declared static?