欢迎来到易学考试网 易学考试官网
全部科目 > Java认证考试 > Java认证考试综合练习

多项选择题

现有: 
class Waiting implements Runnable  {      
boolean flag=false; 
public  synchronized void run()  {      
if  (flag)  {      
flag=false; 
System.out.print ("1"); 
try  {  this.wait();  )  catch  (Exception e)  {  }      
System.out.print ("2");      
} 
else  {      
flag=true; 
System.out.print ("3"); 
try{Thread.sleep (2000); } catch(Exception e)  {}     
System.out.print ("4");      
notify();      
}      
} 
public static void main (String  []  args)  {      
Waiting w=new Waiting();      
new Thread (w) .start();      
new Thread (w) .start();      
}      
} 
以下哪两项是正确的?()    

    A.代码输出l 3 4
    B.代码输出3 4 1
    C.代码输出l 2 3 4
    D.代码输出1 3 4 2
    E.代码运行完毕
    F.代码不会完成

点击查看答案&解析

相关考题

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

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