Examveda

Which of these statement is incorrect?

A. A thread can be formed by implementing Runnable interface only

B. A thread can be formed by a class that extends Thread class

C. start() method is used to begin execution of the thread

D. run() method is used to begin execution of a thread before start() method in special cases

Answer: Option D

Solution (By Examveda Team)

Option A is correct: You can create a thread by implementing the Runnable interface. Your class provides the run() method, which contains the code the thread will execute.
Option B is correct: You can also create a thread by extending the Thread class. This is another way to define what the thread will do within the run() method.
Option C is correct: The start() method is crucial. It's what actually initiates the thread's execution. It prepares the thread and then calls the run() method in a separate thread of execution.
Option D is incorrect: You should never call the run() method directly to start a thread. Calling run() directly simply executes the code within the run() method in the current thread, rather than creating a new thread. To properly start a thread, you must use the start() method.

This Question Belongs to Java Program >> Threads

Join The Discussion

Comments (1)

  1. Ganesh Commn
    Ganesh Commn:
    2 months ago

    A and D both are wrong

Related Questions on Threads

What is a thread in Java?

A. A lightweight process that runs independently within a program

B. A data structure to store variables

C. A type of loop

D. A synchronization mechanism