[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"$fbT8zdaP6qoctEZkeZKdXI-gHflWwu2X4h1FzQ5Kk0UA":3},{"answer":4,"createTime":5,"id":6,"options":7,"origin":12,"question":19,"related":20,"source":30,"type":31},[],"2023-05-17 10:47:02",14244974,[8,9,10,11],"必须从同步方法或同步块中调用wait(),notify()和notifyAll()方法","调用wait()时,它将暂停线程并同时释放对象上的锁. 在收到通知后重新启动线程时,将自动重新获得锁","notify()方法只能唤醒一个等待的线程","在对象上调用notify()方法时,如果没有线程在等待对象,则会发生异常",{"count":13,"courseId":14,"courseImg":15,"courseName":16,"workId":17,"workName":18},6,"afebbbe8debe5f1fc24a01f11c5618c9","https:\u002F\u002Ftihai-oss-cloud.itihey.com\u002Fimg\u002F6884536a76377921d52baf2f6464bbf6.png","高级语言程序设计","22ab0b41e7894de3ba8c697344c174e4","单元作业14(副本)","下面关于内置监视器的陈述,错误的是_________",[21,32,41,50,53,64],{"answer":22,"createTime":5,"id":23,"options":24,"question":29,"source":30,"type":31},[],14244971,[25,26,27,28],"程序不能编译通过,因为this不能在一个静态方法中被引用","程序编译正确, 但是没有打印任何信息,因为没有调用run()方法","程序编译和运行正确,并在控制台显示test","其它均不正确","分析代码,下列描述正确的是 ?public class Test implements Runnable { public static void main(String[] args) { Thread t = new Thread(this); t.start(); } public void run() { System.out.println(&quot;test&quot;); }}","v1",0,{"answer":33,"createTime":5,"id":34,"options":35,"question":40,"source":30,"type":31},[],14244972,[36,37,38,39],"Lock lock = new Lock()","Lock lock = new ReentrantLock()","Lock lock = new ReentrantLock(true)","Lock lock = new ReentrantLock(false)","以下_________ 是创建锁的正确语句,并且让等待时间最长的线程将首先获取该锁",{"answer":42,"createTime":5,"id":43,"options":44,"question":49,"source":30,"type":31},[],14244973,[45,46,47,48],"程序创建了两个线程: 一个向stack中添加数据,一个从stack中获取数据","程序有一个编译错误,因为Producer类中的notifyAll()方法没有通过stack对象来调用","程序抛出一个异常,因为Producer类中的notifyAll()方法没有通过stack对象来调用","程序有一个逻辑错误","分析代码.下面陈述正确的是 ?import java.util.*;public class Test { private Stack stack = new Stack(); private int i = 0; public static void main(String[] args) { new Test(); } public Test() { new Producer().start(); new Consumer().start(); } class Producer extends Thread { public void run() { while (true) { System.out.println(&quot;Producer: put &quot; + i); stack.push(new Integer(i++)); synchronized (stack) { notifyAll(); } } } } class Consumer extends Thread { public void run() { while (true) { synchronized (stack) { try { while (stack.isEmpty()) stack.wait(); System.out.println(&quot;Consumer: get &quot; + stack.pop()); } catch (InterruptedException ex) { ex.printStackTrace(); } } } } }}",{"answer":51,"createTime":5,"id":6,"options":52,"question":19,"source":30,"type":31},[],[8,9,10,11],{"answer":54,"createTime":5,"id":55,"options":56,"question":62,"source":30,"type":63},[],14244975,[57,58,59,60,61],"sleep(long milliseconds)","wait()","notify()","notifyAll()","toString()","以下_________方法在Object类中定义",1,{"answer":65,"createTime":5,"id":66,"options":67,"question":71,"source":30,"type":63},[],14244976,[57,68,69,70],"yield()","stop()","suspend()","可以使用_________方法来临时让出时间给其他线程"]