1Z0-819 · Question #104
Which two statements correctly describe capabilities of interfaces and abstract classes? (Choose two.)
The correct answer is A. Interfaces cannot have protected methods but abstract classes can. C. Interfaces cannot have static methods but abstract classes can. Option A is correct because interface methods must be public (or in Java 9+, private) - protected is not a valid access modifier for interface members. Abstract classes, by contrast, freely support protected methods, making A an accurate distinction. Option C is correct in the…
Question
Options
- AInterfaces cannot have protected methods but abstract classes can.
- BBoth interfaces and abstract classes can have final methods.
- CInterfaces cannot have static methods but abstract classes can.
- DInterfaces can have methods with bodies but abstract classes cannot.
- EInterfaces cannot have methods with bodies but abstract classes can.
How the community answered
(51 responses)- A78% (40)
- B12% (6)
- D6% (3)
- E4% (2)
Explanation
Option A is correct because interface methods must be public (or in Java 9+, private) - protected is not a valid access modifier for interface members. Abstract classes, by contrast, freely support protected methods, making A an accurate distinction.
Option C is correct in the context of this exam (targeting pre-Java 8 behavior), where interfaces were restricted to abstract method declarations and static methods were only permitted in abstract classes. Be aware that Java 8+ did add static method support to interfaces, so this answer assumes a traditional or pre-Java-8 model.
B is wrong because interfaces cannot declare final methods - final means "cannot be overridden," which conflicts with the requirement that interface methods be implemented by subclasses. Abstract classes can have final concrete methods.
D is wrong because it inverts the truth: abstract classes have always supported concrete methods with bodies, while interfaces (pre-Java 8) could not.
E is wrong because in Java 8+ interfaces can have methods with bodies via default and static keywords, making the absolute statement false.
Memory tip: Think of an abstract class as a partial blueprint (can do almost everything a regular class can) and an interface as a strict contract (historically only public, abstract, no statics, no implementation) - restrictions relax with each Java version.
Topics
Community Discussion
No community discussion yet for this question.