Multiple choice technology programming languages

Which of the following can be marked Static ? (A)Initialization blocks (B)A class nested within another class, but not within a method

  1. Only A

  2. Only B

  3. None of these

  4. Both A & B

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

In Java, both static initialization blocks and static nested classes are valid. Static initialization blocks run once when the class loads, useful for complex static initialization. Static nested classes are associated with the outer class rather than an instance, independent of outer class instances.