Multiple choice technology programming languages

Can inner class have static members?

  1. True

  2. False

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Non-static inner classes in Java cannot have static members because they are associated with an instance of the enclosing class. Static members belong to the class itself, not an instance, creating a fundamental conflict. However, static nested classes (declared with 'static' keyword) can have static members. The question is technically correct but should specify 'non-static inner class'.