Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

clarification on the concept of Java thread

which is the thread that will begin as soon as the execution of a java program begins? This was asked in an interview for me. so can anyone suggest the answer here

like image 479
Raghu Avatar asked Jun 19 '26 07:06

Raghu


2 Answers

From Thread API document

When a Java Virtual Machine starts up, there is usually a single non-daemon thread (which typically calls the method named main of some designated class).

And this thread will be called as main thread.

like image 140
Abimaran Kugathasan Avatar answered Jun 20 '26 22:06

Abimaran Kugathasan


The thread which is created when you start is called the main thread. It is the one which invokes the main method.

Edit: apparently someone beat me to the answer.

like image 22
user1803551 Avatar answered Jun 20 '26 21:06

user1803551