modifiers that allowed for methods in an Interface
-
public, abstract
-
abstract, final
-
final
-
public
Methods in an interface are implicitly public and abstract. The 'public' modifier ensures they can be accessed from anywhere, and 'abstract' indicates they must be implemented by the implementing class. Methods cannot be 'final' in an interface because that would prevent implementation, which defeats the purpose of an interface.
Correct answer: public, abstract. Before Java 8, every method declared in an interface was implicitly public and abstract — you were never required to write those keywords, but if you did specify modifiers explicitly, only public and abstract were legal (Java 8+ later allowed default and static too, and Java 9 added private, but those aren't offered here). 'abstract, final' is wrong because final and abstract are contradictory — a final method can't be overridden, but interface methods exist specifically to be implemented/overridden. 'final' alone is wrong for the same reason. 'public' alone is incomplete — interface methods are also implicitly abstract unless given a body.