Java SE 11 Developer (1Z0-819) — Question 87
Given:
public interface ExampleInterface{ }
Which two statements are valid to be written in this interface? (Choose two.)
Answer options
- A. public String methodD();
- B. public int x;
- C. final void methodG(){ System.out.println("G"); }
- D. final void methodE();
- E. public abstract void methodB();
- F. public void methodF(){ System.out.println("F") ; }
- G. private abstract void methodC();
Correct answer: A, E
Explanation
Options A and E are correct because they define valid method signatures in an interface, which allows public and abstract methods. Options B, C, F, and G are incorrect; B cannot declare a variable in an interface without being static and final, C and F contain method bodies which are not allowed, and G cannot be private as interface methods are implicitly public.