Practice mode Java

What can a Java abstract class declare that an interface cannot?

Correct answer D. Non-final instance fields

Explanation

An abstract class can keep mutable per-object state in ordinary instance fields, whereas every interface field is a static final constant. Modern interfaces can declare static methods, abstract methods and nested types, so those no longer separate the two. Shared state is therefore the main technical reason to prefer an abstract class today.

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.