Java · Question 21 · Medium

Which of the following statements about interfaces is true in Java 8 and later?

  1. An interface can have instance fields that each object gets its own copy of
  2. An interface can contain default methods that have a body
  3. An interface can have a public constructor
  4. A class can implement only one interface
Answer and explanation

Answer: B. An interface can contain default methods that have a body

Explanation: Since Java 8, interfaces may define default and static methods with bodies. Interface fields are implicitly public static final, interfaces cannot have constructors, and a class can implement many interfaces.

Previous: What will be the output of the following Java program? · Next: What will be the output of the following Java program?

Practise java

Try a fresh set of java questions with an explanation after every answer, free and without signing up: Java practice. Or sit a full placement mock test.

More java questions

More technical & programming practice

Python · Data Structures · Algorithms · Object-Oriented Programming · DBMS · SQL · Operating Systems · Computer Networks

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge