Which of the following methods is used to start a thread in Java?

Java MCQ: Which of the following methods is used to start a thread in Java?

a) run()
b) start()
c) execute()
d) init()

Answer:

b) start()

Explanation:

In Java, the start() method is used to begin the execution of a thread. When start() is called, the Java Virtual Machine (JVM) creates a new thread of execution and calls the thread’s run() method.

It is important not to call run() directly, as this would simply execute the method in the current thread rather than starting a new thread. The start() method ensures that the thread’s execution occurs concurrently with other threads, enabling multi-threading in Java applications.

Properly managing threads and understanding the distinction between start() and run() is crucial for writing effective multi-threaded Java programs.

Reference links:

https://www.rameshfadatare.com/learn-java-programming/
https://www.javaguides.net/p/java-tutorial-learn-java-programming.html

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top