ProgrammingHardGATE CS · TCS NQT Prime · Product Company SDE

Which of these can a Java interface still NOT have, even in a modern version such as Java 17?

  1. A. default methods with a body
  2. B. private helper methods (allowed since Java 9)
  3. C. Instance (non-static) fields holding genuinely mutable, per-object state
  4. D. static methods

Correct answer: C. Instance (non-static) fields holding genuinely mutable, per-object state

Every field declared in an interface is implicitly public static final (a constant); interfaces still cannot hold ordinary mutable instance state the way a class can.

More OOP with C++ and Java questions

Exams that ask this topic