🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.Yes, it makes all its methods static
  2. B.Yes, but only if it is also final
  3. C.Only the class that contains main
  4. 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 →