[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"$f3bQU08PGTuV03DAubhHiRUTgIpt88sKbCFf59mePPQs":3},{"answer":4,"createTime":5,"id":6,"options":7,"origin":13,"question":20,"related":21,"source":31,"type":63},[],"2023-05-17 10:47:02",14244975,[8,9,10,11,12],"sleep(long milliseconds)","wait()","notify()","notifyAll()","toString()",{"count":14,"courseId":15,"courseImg":16,"courseName":17,"workId":18,"workName":19},6,"afebbbe8debe5f1fc24a01f11c5618c9","https:\u002F\u002Ftihai-oss-cloud.itihey.com\u002Fimg\u002F6884536a76377921d52baf2f6464bbf6.png","高级语言程序设计","22ab0b41e7894de3ba8c697344c174e4","单元作业14(副本)","以下_________方法在Object类中定义",[22,33,42,51,60,64],{"answer":23,"createTime":5,"id":24,"options":25,"question":30,"source":31,"type":32},[],14244971,[26,27,28,29],"程序不能编译通过,因为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":34,"createTime":5,"id":35,"options":36,"question":41,"source":31,"type":32},[],14244972,[37,38,39,40],"Lock lock = new Lock()","Lock lock = new ReentrantLock()","Lock lock = new ReentrantLock(true)","Lock lock = new ReentrantLock(false)","以下_________ 是创建锁的正确语句,并且让等待时间最长的线程将首先获取该锁",{"answer":43,"createTime":5,"id":44,"options":45,"question":50,"source":31,"type":32},[],14244973,[46,47,48,49],"程序创建了两个线程: 一个向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":52,"createTime":5,"id":53,"options":54,"question":59,"source":31,"type":32},[],14244974,[55,56,57,58],"必须从同步方法或同步块中调用wait(),notify()和notifyAll()方法","调用wait()时,它将暂停线程并同时释放对象上的锁. 在收到通知后重新启动线程时,将自动重新获得锁","notify()方法只能唤醒一个等待的线程","在对象上调用notify()方法时,如果没有线程在等待对象,则会发生异常","下面关于内置监视器的陈述,错误的是_________",{"answer":61,"createTime":5,"id":6,"options":62,"question":20,"source":31,"type":63},[],[8,9,10,11,12],1,{"answer":65,"createTime":5,"id":66,"options":67,"question":71,"source":31,"type":63},[],14244976,[8,68,69,70],"yield()","stop()","suspend()","可以使用_________方法来临时让出时间给其他线程"]