• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

please eplain this thread question

 
alwin das
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1] Are the following statements true?


1)A timeout argument can be passed to join methods
2)join methods needs the InterruptedException in its throws clause like sleep and wait?
3)If execution of the synchronised block completes abruptly, then the lock is released
4)The Thread.sleep method causes the thread to move to the Not-Runnable state
5)Some implementations of the Thread.yield method will not yield to a thread of lower priority


2]if the thread calling wait() method doesnt own the lock then illegalMonitorStateEception is thrown which is unchecked

so does it mean it is runtime eception so can we conclude that
wait() throws runtime exception

3)what is non runnable state? with respect to following question
Which of the following thread state transitions model the lifecycle of a thread?

a. The Dead state to the Ready state
b. The Ready state to the Not-Runnable state
c. The Ready state to the Running state
d. The Running state to the Not-Runnable state
e. The Running state to the Ready state
f. The Not-Runnable state to the Ready state
g. The Not-Runnable state to the Running state



4)
why the run method of class A is called and not of class B

why the o/p is A and not B?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
alwin, what do you think about these questions? (Hint: Many of them can be quickly verified by checking the API.)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic