wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes ambiguity in Master Exam option Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "ambiguity in Master Exam option" Watch "ambiguity in Master Exam option" New topic
Author

ambiguity in Master Exam option

Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9302
    
  17

I was solving one of the master exams and I came up to this option

wait() method can be called from non-synchronized context...

The master exam says this option is false. But the wait method can be called from non-synchronized context. There will be no compilation error only a run time MonitorStateException.

So in the exam will this be explicitly mentioned like this

calling wait() method from non-synchronized context will compile successfully

OR

calling wait() method from non-synchronized context will result in no runtime exception


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
sannuth kashikar
Greenhorn

Joined: Sep 16, 2008
Posts: 14
hi,
you will know that in exam.

about the question

wait() method "cannot" be called from non-synchronized context...

wait() method throws runtime exception IllegalMonitorStateException if the current thread is not the owner of the object's monitor.Runtime exceptions are due to logical errors,you have to go back to the code and work on logic to convince JVM .
So "cannot" would be more appropriate.


scjp5 90%
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ambiguity in Master Exam option