File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Statements regarding to the Thread

 
Jo Liang
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What CAN directly cause a thread to stop executing?
A. Existing from a synchronized block
B. Calling the wait method on an object
C. Calling notify method on an object
D. Calling read method on an InputStream object
E. Calling the SetPriority method on a Thread object
Can somebody help me with this one? Thank you.
An other question, while a thread is running (already got the CUP), it that possible that other tread with higher priority (in Ready-to-Run state) takes over?

 
R K Singh
Ranch Hand
Posts: 5382
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A. Existing from a synchronized block:
No it does not gaurantee that thread will stop executing.
B. Calling the wait method on an object
Yes thread will stop executing, leave the monitor
C. Calling notify method on an object
No it does not gaurantee that thread will stop executing.
D. Calling read method on an InputStream object
Thread will not stop executing but will be in blocked state(I do not know whether it will come under not executing state.)
E. Calling the SetPriority method on a Thread object
will depend on OS.
CMIW
------------------
Regards
Ravish
 
Vikrama Sanjeeva
Ranch Hand
Posts: 756
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A:FALSE
B:TRUE
C:FALSE
D:One cant say that does the i/p task is completed as it is required by thread or it has to wait.In 2nd condition it goes to wait state & it's execution stops.
E:FALSE
------------------
Count the flowers of ur garden,NOT the leafs which falls away!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic