[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"$f8k4DAP6_daAKnyY_ZCVzBxUvhsGTZgp50Bos8IpEUp4":3},{"answer":4,"createTime":5,"id":6,"options":7,"origin":12,"question":19,"related":20,"source":30,"type":31},[],"2025-06-15 19:22:42",199210099,[8,9,10,11],"在对象上调用notify()方法时,如果没有线程在等待对象,则会发生异常","调用wait()时,它将暂停线程并同时释放对象上的锁. 在收到通知后重新启动线程时,将自动重新获得锁","必须从同步方法或同步块中调用wait(),notify()和notifyAll()方法","notify()方法只能唤醒一个等待的线程",{"count":13,"courseId":14,"courseImg":15,"courseName":16,"workId":17,"workName":18},40,"53e1d2ef4961cca8eea3e23969ad2cb9","https:\u002F\u002Ftihai-oss-cloud.itihey.com\u002Fimg\u002F03a579384a6dc297c89809b582fcc767.png","默认课程","work_43584581","多线程概念题20230526183406","下面关于内置监视器的陈述,错误的是_________",[21,32,41,50,60,69,72,82,91,97],{"answer":22,"createTime":5,"id":23,"options":24,"question":29,"source":30,"type":31},[],199210094,[25,26,27,28],"该程序编译并运行,并显示test","该程序编译并运行,什么也不显示","该程序有一个编译错误,因为在main()方法和构造函数Test()中都定义了t","该程序可以正常编译,但无法运行,因为不能在构造函数中使用关键字this","分析代码:public class Test implements Runnable { public static void main(String[] args) { Test t = new Test(); } public Test() { 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},[],199210095,[36,37,38,39],"程序显示test两次","程序显示test一次","一个java.lang.IllegalThreadStateException异常被抛出,因为您刚刚启动线程,并且在再次启动线程之前线程可能尚未完成","没有任何显示","运行下列程序时,会发生________ ?public class Test extends Thread { public static void main(String[] args) { Test t = new Test(); t.start(); t.start(); } public void run() { System.out.println(&quot;test&quot;); }}",{"answer":42,"createTime":5,"id":43,"options":44,"question":49,"source":30,"type":31},[],199210096,[45,46,47,48],"condition.waiting()","condition.waited()","condition.await()","condition.wait()","应在条件上调用_________ 方法使当前线程等待,直到发出条件信号为止",{"answer":51,"createTime":52,"id":53,"options":54,"question":59,"source":30,"type":31},[],"2025-06-12 15:20:13",199210097,[55,56,57,58],"ExecutorService executor = Executors.newFixedThreadPool(1); executor.execute(task1); executor.execute(task2); executor.execute(task3)","ExecutorService executor = Executors.newFixedThreadPool(2); executor.execute(task1); executor.execute(task2); executor.execute(task3)","ExecutorService executor = Executors.newFixedThreadPool(3); executor.execute(task1); executor.execute(task2); executor.execute(task3)","new Thread(task1).start(); new Thread(task2).start(); new Thread(task3).start()","假设有三个可运行任务,task1,task2,task3. 如何在具有2个固定线程的线程池中运行它们",{"answer":61,"createTime":5,"id":62,"options":63,"question":68,"source":30,"type":31},[],199210098,[64,65,66,67],"condition.wakeAll()","condition.signalAll()","condition.wake()","condition.signal()","应在条件上调用_________ 方法唤醒所有等待的线程",{"answer":70,"createTime":5,"id":6,"options":71,"question":19,"source":30,"type":31},[],[8,9,10,11],{"answer":73,"createTime":5,"id":74,"options":75,"question":81,"source":30,"type":31},[],199210100,[76,77,78,79,80],"sleep(long)","start()","run()","join()","setPriority(int)","java.lang.Thread的________ 方法是静态的",{"answer":83,"createTime":52,"id":84,"options":85,"question":90,"source":30,"type":31},[],199210101,[86,87,88,89],"ExecutorService executor = Executors.newCachedThreadPool()","ExecutorService executor = Executors.newCachedThreadPool(2)","ExecutorService executor = Executors.newCachedThreadPool(1)","ExecutorService executor = Executors.newCachedThreadPool(3)","如何创建缓存的线程池",{"answer":92,"createTime":52,"id":93,"options":94,"question":96,"source":30,"type":31},[],199210102,[78,77,76,80,95],"yield()","Thread类的________ 方法抛出InterruptedException异常",{"answer":98,"createTime":5,"id":99,"options":100,"question":105,"source":30,"type":31},[],199210103,[101,102,103,104],"字符a和b随机打印","aaaabbbb","abababab","bbbbaaaa","下列代码的输出结果是_________ ?public class Test { public static void main(String[] args) { new Test(); } public Test() { PrintChar printA = new PrintChar('a', 4); PrintChar printB = new PrintChar('b', 4); printA.run(); printB.run(); } class PrintChar implements Runnable { private char charToPrint; \u002F\u002F The character to print private int times; \u002F\u002F The times to repeat public PrintChar(char c, int t) { charToPrint = c; times = t; } public void run() { for (int i = 0; i &lt; times; i++) System.out.print(charToPrint); } }}"]