Difficulty: Easy
Correct Answer: 1, 2 and 3
Explanation:
Introduction / Context:
In Java, all fields declared in an interface are implicitly public, static, and final. Recognizing this is fundamental for Java language semantics and avoids redundant modifiers or invalid ones.
Given Data / Assumptions:
Concept / Approach:
Interface fields are constants: public static final. Therefore, explicitly writing any subset of these (that still implies the constant nature) is equivalent in meaning. Invalid modifiers (abstract for fields, volatile for interface constants) are not equivalent.
Step-by-Step Solution:
Verification / Alternative check:
Compile each variant inside an interface and observe that 1–3 compile; 4–5 do not or do not match semantics.
Why Other Options Are Wrong:
abstract does not apply to fields; volatile contradicts final and constant semantics.
Common Pitfalls:
Assuming interface fields behave like class fields; they do not—they are constants.
Final Answer:
1, 2 and 3
Discussion & Comments