网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

Thread类的join()方法会抛出InterruptedException异常。()


参考答案和解析
错误
更多 “Thread类的join()方法会抛出InterruptedException异常。()” 相关考题
考题 在J2EE中,VetoableChangeSupport的fireVetoableChange方法会抛出的异常是()。 A.PropertyExceptionB.PropertyVetoExceptionC.VetoExceptionD.PropertyChangeException

考题 阅读下列代码 public class Test implements Runnable{ public void run(Thread t){ System. out. println("Running. "); } public static void main(String[]args){ Thread tt=new Thread(new Test()); tt. start(); } } 代码运行结果是A.将抛出一个异常B.没有输出并正常结束C.输出“Running”并正常结束D.程序第2行将出现一个编译错误

考题 下列程序的功能是在监控台上每隔一秒钟显示一个字符串“你好!”,能够填写在程序中画线位置,使程序完整并能正确运行的语句是 public class Exam implements Runnable{ public static void main(String args[]){ Exam t=new Exam(); Thread tt=new Thread(t); tt.start(); } public void run(){ for(;;){ try{ ; }catch(e){} System.out.println("你好!"); } } }A.sleep(1) RuntimeExceptionB.t.sleep(1000) InterruptedExceptionC.Thread.sleep(1) InterruptedExceptionD.Thread.sleep(1000) InterruptedException

考题 GiventhatTriangleimplementsRunnable,and:Whichtwostatements,insertedindependentlyatbothlines35and41,tendtoallowboththreadstotemporarilypauseandallowtheotherthreadtoexecute?() A.Thread.wait();B.Thread.join();C.Thread.yield();D.Thread.sleep(1);E.Thread.notify();

考题 哪两个java.lang.Thread方法抛出受检异常?() A.runB.joinC.sleepD.start

考题 阅读以下说明和Java代码,回答问题1和问题2,将解答填写在对应栏内。【Java代码】class usethread implements (1) {int numusethread(int n){num=n;}public void (2) {for(int i=0;i<3;i++)System.out.println("running:"+num);System.out.println("finished:"+num);}public class multhread{public static void main(String args[]) (3) InterruptedException{Thread m1=new Thread(new usethread(1));Thread m2=new Thread(new usethread(2));m1.start();m2.start();m1.join();m2.join();}}【问题1】补充完整上面Java代码中(n)处。【问题2】写出上面Java代码运行的结果。

考题 阅读下面代码 public class Test implements Runnable { public void run(Thread t) { System.out.println("Running"); } public static void main(String[] args) { Thread tt=new Thread(new Test()); tt.start(); } } 代码运行的结果是A.将抛出一个异常B.没有输出并正常结束C.输出“Running”并正常结束D.程序第2行将出现一个编译错误

考题 下列方法中,声明抛出InterruptedException类型异常的方法是A.suspended()B.resume()C.sleep()D.start()

考题 当使用SomeThread t=new SomeThread( )创建-个线程时,下列叙述中正确的是( )。A.Some Thread类是包含run( )方法的任意Java类B.Some Thread类-定要实现Runnable接口C.Some Thread类是Thread类的子类D.Some Thread类是Thread类的子类并且要实现Run-nable接口

考题 以下不属于Thread类提供的线程控制方法的是( )。A.bmak()B.sleep()C.yield()D.join()

考题 自定义异常类的父类可以是( )。A.ErrorB.VirtuaMachineErrorC.ExceptionD.Thread

考题 下列方法中,声明抛出InterruptedException类型异常的方法是( )。A.suspendB.resumeC.sleepD.start

考题 自定义异常类的父类可以是( )。 A.ErrorB.VirtuaMachineErrorC.ExceptionS 自定义异常类的父类可以是( )。A.ErrorB.VirtuaMachineErrorC.ExceptionD.Thread

考题 用Thread子类实现多线程的步骤顺序是( ) A、声明Thread类的子类,创建Thread子类的实例,让线程调用start()方法B、声明Thread类的子类,在子类中重新定义run()方法,创建Thread子类的实例C、创建Thread子类的实例,让线程调用start()方法D、声明Thread类的子类,在子类中重新定义run()方法,创建Thread子类的实例,让线程调用start()方法

考题 能抛出异常必须是下列哪个类或其子类的实例?A.throwsB.throwC.ThrowableD.Exception

考题 程序中抛出异常时(throw …),只能抛出自己定义的异常对象。

考题 public class A extends Thread {  A() {  setDaemon(true);  }  public void run() {  (new B()).start();  try {  Thread.sleep(60000);  } catch (InterruptedException x) {}  System.out.println(“A done”);  }  class B extends Thread {  public void run() {  try {  Thread.sleep(60000);  } catch (InterruptedException x) {}  System.out.println(“B done”);  }  }  public static void main(String[] args) {  (new A()).start();  }  }   What is the result?()  A、 A doneB、 B doneC、 A done B doneD、 B done A doneE、 There is no exception that the application will print anything.F、 The application outputs “A done” and “B done”, in no guaranteed order.

考题 下面关于Java中线程的说法不正确的是()A、调用join()方法可能抛出异常InterruptedException。B、sleep()方法是Thread类的静态方法。C、调用Thread类的sleep()方法可终止一个线程对象。D、线程启动后执行的代码放在其run方法中。

考题 现有:   class Thread2 implements Runnable {   void run() {   System.out.print("go ");   }   public static void main(String [] args) {   Thread2 t2 = new Thread2();   Thread t = new Thread(t2);   t.start();   }   }   结果为:()A、 goB、 编译失败C、 代码运行,无输出结果D、 运行时异常被抛出

考题 class Work implements Runnable {  Thread other;   Work(Thread other) { this.other = other; }  public void run() {  try { other.join(); } catch (Exception e) { }  System.out.print("after join ");  } }  class Launch {  public static void main(String [] args) {  new Thread(new Work(Thread.currentThread())).start();  System.out.print("after start ");  } }  结果为:()A、after joinB、after startC、after join after startD、after start after join

考题 现有:  class ThreadBoth extends Threaa implements Runnable  {      public void run()  (System.out.print("hi");  }     public static voicl main (String  []  args)  {     Thread tl=new ThreadBoth():      Thread t2 = new Thread (tl):     tl.run():      t2.run():     }          结果为:()      A、 hi hiB、 hiC、编译失败D、运行时异常被抛出

考题 多选题哪两个java.lang.Thread 方法抛出受检异常?()ArunBjoinCsleepDstart

考题 单选题public class A extends Thread {  A() {  setDaemon(true);  }  public void run() {  (new B()).start();  try {  Thread.sleep(60000);  } catch (InterruptedException x) {}  System.out.println(“A done”);  }  class B extends Thread {  public void run() {  try {  Thread.sleep(60000);  } catch (InterruptedException x) {}  System.out.println(“B done”);  }  }  public static void main(String[] args) {  (new A()).start();  }  }   What is the result?()A  A doneB  B doneC  A done B doneD  B done A doneE  There is no exception that the application will print anything.F  The application outputs “A done” and “B done”, in no guaranteed order.

考题 单选题1. class A implements Runnable (  2. int i;  3. public void run ( ) (  4. try (  5. thread.sleep(5000);  6. i= 10;  7. ) catch(InterruptedException e) {}  8. )  9. )  10.    11. public class Test {  12. public static void  main (string args[]) ( 13. try (  14. A a = new A ( );  15. Thread t = new Thread (a);  16. t.start( );  17.    18. int j= a.i;  19.    20. ) catch (Exception e) {}  21. )  22. }   Which statement al line 17 will ensure that j=10 at line 19?()A  a.wait();B  t.wait();C  t.join();D  t.yield();E  t.notify();F  a.notify();G  t.interrupt();

考题 单选题下面关于Java中线程的说法不正确的是()A 调用join()方法可能抛出异常InterruptedException。B sleep()方法是Thread类的静态方法。C 调用Thread类的sleep()方法可终止一个线程对象。D 线程启动后执行的代码放在其run方法中。

考题 单选题在J2EE 中,VetoableChangeSupport的fireVetoableChange方法会抛出的异常是()。A PropertyExceptionB PropertyVetoExceptionC VetoExceptionD PropertyChangeException

考题 单选题class Thread2 implements Runnable {   void run() {    System.out.print("go ");    }   public static void main(String [] args) {   Thread2 t2 = new Thread2();   Thread t = new Thread(t2);   t.start();    }    }    结果为:()A  goB  编译失败C  代码运行,无输出结果D  运行时异常被抛出

考题 单选题现有:  class ThreadBoth extends Threaa implements Runnable  {      public void run()  (System.out.print("hi");  }     public static voicl main (String  []  args)  {     Thread tl=new ThreadBoth():      Thread t2 = new Thread (tl):     tl.run():      t2.run():     }          结果为:()A  hi hiB  hiC 编译失败D 运行时异常被抛出