aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "thread" Watch "thread" New topic
Author

thread

sheri
Ranch Hand

Joined: Sep 14, 2000
Posts: 43
hi

What might cause the current thread to stop executing?
A.

An InterruptedException is thrown
B.

The thread executes a sleep() call
C.

The thread constructs a new Thread
D.

A thread of higher priority becomes ready (runnable)
E.

The thread executes a read() call on an InputStream
to me the ans are:a,b,d
the ans given are:a,b,d,e

help please
sherin
srikrish
Ranch Hand

Joined: Sep 12, 2000
Posts: 63
Sherin,
During the read() call, the thread is still alive and listening for any input. It only goes into a waiting state. If the thread stops, then it wont be able to read the input. So, e is wrong.
Sandeep Potnis
Ranch Hand

Joined: Aug 18, 2000
Posts: 39
I think e is also right.
A thread goes from runnable state to blocked state with any I/O request and waits for the I/O to finish. Once the I/O is finished it goes to ready state and competes, for the processor's attention, with other threads in ready state.
rgds
Sandeep
Sandeep Potnis
Ranch Hand

Joined: Aug 18, 2000
Posts: 39
srikrish,
I saw your reply after posting mine. I think it depends what stopping a thread means. Does it mean Drop dead or Stop hogging the CPU ?
thanks Sandep
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: thread
 
Similar Threads
Threads
Thread
Thread stop executing
Thread1
threads?