MannY Gates

Ranch Hand
+ Follow
since Nov 05, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by MannY Gates

Kudos to you Netty... I am impressed...
Congrats...
Swapnil I understand your intention of posting a message in this forum...
I think you are right... You wanted to share the details about the scjp exam and how to tackle the exam and which is why this section of forum has been created. All the moderators understand this... otherwise they would have moved the message immediately.

Once again Thanks for writing in such details.
Swapnil I understand your intention of posting a message in this forum...
I think you are right... You wanted to share the details about the scjp exam and how to tackle the exam and which is why this section of forum has been created. All the moderators understand this... otherwise they would have moved the message immediately.

Once again Thanks for writing in such details.
19 years ago
Let us know whether u r still surviving or not
Henry You are right... I overlooked the synchronized keyword on setPrice method... The lock is achieved on Object "s" and hence s.setAPrice is never called...

Thanks.
Code taken from http://www.jchq.net/phezam/exam.php Exam Question No: 37 Question Bank Id:249

When I compile and run the below code I get infinite o/p of 100.

Could any one tell me why the s.setPrice(200) method is not called??

According to me it should call the setPrice method and if it is not able to call it then it should give unreachable code error...



Congratulations Swapnil...

Thanks for providing such a great detail about the exam.

I hope Bert Bates answers your question about the survey for the benefit of all.
Congratulations Swapnil...

Thanks for providing such a great detail about the exam.

I hope Bert Bates answers your question about the survey for the benefit of all.
19 years ago
Thanks to everyone for pitching in.

To make things sure about the fact that the daemon thread continues it's execution till the presence of any of the user thread, I created the user thread in another hierarchy ( Created thread "Three" as a child of thread "One" and made sure that threa one and two are daemons. )

The result proved that the daemon thread survives till the presence of any of the user thread (and ofcource the thread which creates it).

Can anyone point me to the theoretical resource which states this fact?


Below is the sample code:

In the below code I have created one daemon thread and one user thread.
According to my understanding the daemon thred should die along with the main thread (Since it was created by main thread). This is not happening when I compile and run the below program. The daemon thread continues it's execution along with the user thread.

Any thoughts???


Thanks Dave and Nicholas.
I have Java 2 v5.0 Tiger (Tata McGraw... Herbert Schildt) and Java 1.5 Tiger A developer's notebook.
And ofcourse the Language spec e rd edition... Is there anything else missing???
I heard the java 1.5 beta is free... how can I get that voucher???
Way to go Karthik...
Congratulations.....
19 years ago