This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Thread Help!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Thread Help!!!" Watch "Thread Help!!!" New topic
Author

Thread Help!!!

shalini Rajan
Greenhorn

Joined: Dec 02, 2000
Posts: 9
I have some confusion about the old discussion question
http://www.javaranch.com/ubb/Forum24/HTML/000088.html
Locking is the main mechanism for restricting simultaneous thread access to specific java code. Which of the following statement(s) are true regarding locks / monitors?
a)One lock / monitor is associated with each Class
b)One lock / monitor is associated with each Synchronized block
c)One lock / monitor is associated with each Thread
d)One lock / monitor is associated with each Object
e)All of the above
-----> The some of them from the discussion group concluded that
ans a,d is correct and some a,b,d ..which one is correct?
With respect to User and Daemon threads:
a)Daemon threads can not be destroyed
b)Running User threads prevent a Java VM from exiting
c)Running Daemon threads prevent a Java VM from exiting
d)Daemon threads can not be grouped together
e)The Java VM will exit when no non-daemon threads are running
-----> some of them suggest b is correct and some c ..which on e is correct?
Shalini
vadiraj vd
Ranch Hand

Joined: Dec 15, 2000
Posts: 68
Originally posted by shalini Rajan:
I have some confusion about the old discussion question
http://www.javaranch.com/ubb/Forum24/HTML/000088.html
Locking is the main mechanism for restricting simultaneous thread access to specific java code. Which of the following statement(s) are true regarding locks / monitors?
a)One lock / monitor is associated with each Class
b)One lock / monitor is associated with each Synchronized block
c)One lock / monitor is associated with each Thread
d)One lock / monitor is associated with each Object
e)All of the above
-----> The some of them from the discussion group concluded that
ans a,d is correct and some a,b,d ..which one is correct?
With respect to User and Daemon threads:
a)Daemon threads can not be destroyed
b)Running User threads prevent a Java VM from exiting
c)Running Daemon threads prevent a Java VM from exiting
d)Daemon threads can not be grouped together
e)The Java VM will exit when no non-daemon threads are running
-----> some of them suggest b is correct and some c ..which on e is correct?
Shalini

I think the answers for the first question are : a and d.
and for second question b and e are the correct answers.
If a thread calls a synchronized method of a object/class it obtains the monitor of that object/class. Other threads are not allowed to call this synchronized method or any other synchronized methods of that object/class.
Regarding daemon threads the JVM will shuts down if it sees that no user threads are running.


Regards<BR>---------<BR>vadiraj<P><BR>*****************<BR>There's a lot of I in J.<BR>*****************
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread Help!!!
 
Similar Threads
Threads
IBM Sample Question
IBM mock: Daemon and user thread?
I neeed answers for these
daemon thread.