Just to be clear, here is the question 36 from Java Prepare:
Which of the following are true about interfaces. Select the two correct answers.
A. Methods declared in interfaces are implicitly private.
B. Variables declared in interfaces are implicitly public, static, and final.
C. An interface can extend any number of interfaces.
D. The keyword implements indicate that an interface inherits from another.
Answer: B,C
A is clearly wrong as per
JLS 9.4 Abstract Method Declarations B is, in my opinion, badly worded and should read "
Fields declared in interfaces are implicitly public, static, and final." Interface can only declare constants. In this respect, B is correct.
C is clearly correct as per
JLS 9.1.2 Superinterfaces and Subinterfaces D is clearly wrong as the keyword "implement" can only occur in class declarations and not in interface declarations as per
JLS 18.1 The Grammar of the Java Programming Language (in the "ClassDeclaration" production).
Try to compile to following code and you'll see:
It should give you the following error:
expected "{", found implements The error message may vary depending on the compiler you are using.