Search Interview Questions
| 3180 questions in repository.|
There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Have a video suggestion.
Click Correct / Improve and please let us know.
|Java - Interview Questions and Answers|
|Frequently asked to fresh graduates.|
|Ans. Runnable - waiting for its turn to be picked for execution by the thread schedular based on thread priorities.|
Running - The processor is actively executing the thread code. It runs until it becomes blocked, or voluntarily gives up its turn.
Waiting: A thread is in a blocked state while it waits for some external processing such as file I/O to finish.
Sleeping - Java threads are forcibly put to sleep (suspended) with Thread.sleep. they can resume using Thread.resume method.
Blocked on I/O - Will move to runnable after I/O condition like reading bytes of data etc changes.
Blocked on synchronization - Will move to Runnable when a lock is acquired.
Dead - The thread is finished working.
|Help us improve. Please let us know the company, where you were asked this question :|
|Like Discuss Correct / Improve java threads multi threading scheduling thread states basic interview question Cognizant (CTS) basic   frequent|
Try 2 Question(s) Test
| Which keyword is used to provide explicit access of a code block to single thread ? |
|Explain multithreading in Java ?|
|Can constructors be synchronized in Java ?|
|What is the difference between time slicing and preemptive scheduling ?|
|What is a Deadlock ?|
|Why do we need Thread class even in case we execute thread using runnable interface ?|
|If you need to consume messages from the queue faster, which approach will you recommend - batching or concurrency ?|
|What is an object's lock and which object's have locks?|
|Different ways of implementing Threads in Java ?|