Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

State of a thread in Java

I got a question like what is the state of a thread when it is created. And the option has both ready and runnable. So my doubts are,

  1. Is there any state called ready state?
  2. If so then, is there any difference between runnable and ready state of a thread?
  3. If so then, what will be the appropiate answer?

Thanks in advance.

like image 614
Leo Avatar asked Feb 26 '26 23:02

Leo


1 Answers

1 - no, it's NEW

2 - NEW is waiting to be executed, RUNNABLE is executing

3 - NEW

Who could answer better than Oracle: https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.State.html

like image 101
Lucas Avatar answered Feb 28 '26 13:02

Lucas