Practice mode Java

Which keyword lets a Java interface supply a body for an instance method?

Correct answer D. default

Explanation

Since Java 8, an interface instance method marked default has a body that implementing classes inherit unless they override it. This allowed libraries to add methods to existing interfaces without breaking implementers. Marking an interface method final is not permitted, and concrete and virtual are not Java modifiers at all.

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.