Multiple choice technology programming languages

Correct way of method declaration within interface :

  1. void run();

  2. protected void go();

  3. static void get();

  4. public abstract set();

  5. none of these

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In Java interfaces, methods are implicitly public and abstract. Thus, void run(); is a valid declaration. Option two is invalid because interface methods cannot be protected. Option three is invalid because static interface methods require a body. Option four is invalid because it lacks a return type.