Multiple choice

Which method must be defined by a class implementing the java.lang.Runnableinterface?

  1. void run()

  2. public void run()

  3. public void start()

  4. void run(int priority)

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

Option B is correct because in an interface all methods are abstract by default therefore they must be overridden by the implementing class. The Runnable interface only contains 1 method, the void run() method therefore it must be implemented. Option A and D are incorrect because they are narrowing the access privileges i.e. package(default) access is narrower than public access. Option C is not method in the Runnable interface therefore it is incorrect.