欢迎来到建筑考试题库网 建筑考试题库官网
全部科目 > Java认证考试 > SCJP程序员认证考试

单项选择题

void waitForSignal() { 
Object obj = new Object(); 
synchronized (Thread.currentThread()) { 
obj.wait(); 
obj.notify(); 
} 
} 
Which is true?() 

    A. This code may throw an InterruptedException.
    B. This code may throw an IllegalStateException.
    C. This code may throw a TimeoutException after ten minutes.
    D. This code will not compile unless “obj.wait()” is replaced with “((Thread) obj).wait()”.
    E. Reversing the order of obj.wait() and obj.notify() may cause this method to complete normally.
    F. A call to notify() or notifyAll() from another thread may cause this method to complete normally.

点击查看答案&解析

相关考题

微信小程序免费搜题
微信扫一扫,加关注免费搜题

微信扫一扫,加关注免费搜题