x

Choose Country Code

x

Direction

x

Ask a Question

  • Ask a Question
  • Scan a Question
  • Post MCQ
  • Note: File extension must be of jpg, jpeg, png, bmp format and file size must not exceed 5 MB
x

Ask a Question

x

x
x
x
Hire a Tutor

Answers and Solutions

What's Your Question?
Answer
  • By implementing Runnable interface, you need to provide implementation for run() method.
  • To run this implementation class, create a Thread object, pass Runnable implementation class object to its constructor. Call start() method on thread class to start executing run() method.
  • Implementing Runnable interface does not create a Thread object, it only defines an entry point for threads in your object. It allows you to pass the object to the Thread(Runnable implementation) constructor.Following example explains how to implement run method
Answer

As Runnable interface is implemented for implementing Threading in java code and if this interface is implemented then one must override the method present in this interface which is public void run() which is used to define the functionality of the child thread.

Answer
If any explanation you want please ask me...
Answer

public void run() {}

 

Answer

public void run().. All you've done is declare a run() method unrelated to the Thread . ... But that just calls Thread 's run() method, which does nothing. public void run() If this thread was constructed using a separate Runnable run object, then that Runnable object'srun method is called; otherwise, this method does nothing and returns.

Answer
Public void run() ... 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.
Answer

To implement the Thread based implementation application we need to use Runnable interface which is in java.lang package. This interface is having only one method that is run() method which does not take any parameter and does not return any value. In this method we write the code what a thread has to do. This method will be called implicitely by start() method of Thread.

Answer

Any class implementing the java.lang.Runnable interface must define run() method.

Answer
The run() method from runnable interface needs to be implement as any thread starts its execution from the run method.so the initial point of any thread is run().
Answer
Runnable interface has the run() method declaration. run() needs to be wrapped in a Thread instance, which takes care of lifecycle of the Runnable instance.

Post Answer and Earn Credit Points

Get 5 credit points for each correct answer. The best one gets 25 in all.

Post Answer