Win a copy of Java Challengers this week in the Java in General forum!

Abhinav Prakash

Greenhorn
+ Follow
since Jul 19, 2006
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 Abhinav Prakash

I disagree with the fact that the code undermines the notion of word synchronized. The code written i think is correct and i will not have inconsistent value.

Each thread has its own working memory. variable 'i; in this case is the shared memory. When ever a thread sees synchrnoized it locks the object. then it loads the value of the variable from the shared memory to its working memory. The object is locked for wrting the manipulated value from the thread working memory to the shared memory. Till this transition happens no other thread will be able to write to shared memory. however other threads are still able to read the values.
The correct options should be 'a' and 'e'.

since a system exception occured the transaction is marked for roll back. And since the System exception occured in bean B , it is discarded, but that does not Bean A will be discarded.