Which of the methods should be implemented if any class implements the Runnable interface?

Options
- start()
- run()
- wait()
- notify() and notifyAll()


CORRECT ANSWER : run()

Discussion Board
Runnable Interface

void run() method is used when an object is implementing interface Runnable. It is used to create a thread which when starts causes the the object's run method to be called in a separate thread. Runnable interface can be implemented by any class whose instances are intended to be executed by a thread. The class at that point of time should defined a method run() having no arguments. Runnable interface provides a common platform for objects which likely to execute code while in active state. Active state means a thread is started but has not yet been stopped. This interface also provides the means for classes to be active but its subclasses thread can't be active at that point of time.

Rohit Sharma 07-26-2014 07:29 PM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement