← Quiz: static, final and Nested Classes: all 10 questions
Quiz: static, final and Nested Classes · Question 10 of 10
Can a top-level (not nested) class be declared static?
Can a top-level (not nested) class be declared static?
- A.Yes, it makes all its methods static
- B.Yes, but only if it is also final
- C.Only the class that contains main
- D.No, only nested classes can be static
Answer & explanation
Correct answer: No, only nested classes can be static
static on a class only makes sense for a class inside another class.
Can you get the rest right without peeking?
Take the timed Quiz: static, final and Nested Classes quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →