Practice mode Java

Which modifiers does a field declared in a Java interface implicitly have?

Correct answer D. public, static and final

Explanation

Every field in an interface is implicitly public, static and final, so it is a constant that must be initialised where it is declared. An interface cannot hold per-object state. The word abstract applies to methods rather than fields, and declaring an interface field private or protected is a compile-time error.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.