| Author |
Can synchronized( someObj ) ever throw an exception?
|
Dan Bizman
Ranch Hand
Joined: Feb 25, 2003
Posts: 387
|
|
I know that object.wait() can throw an exception (IllegalMonitorStateException or InterruptedException) can synchronized ever do the same? For example: What is that synchronized line in byte code?
|
 |
marc weber
Sheriff
Joined: Aug 31, 2004
Posts: 11343
|
|
|
If you try to synchronize on a null reference, a NullPointerException will be thrown. (See JLS - 14.19.)
|
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
|
 |
 |
|
|
subject: Can synchronized( someObj ) ever throw an exception?
|
|
|