Thread类的sleep方法会抛出()异常。A.IOExceptionB.InterruptedExceptionC.EOFExceptionD.SecurityException

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

A.IOException

B.InterruptedException

C.EOFException

D.SecurityException


参考答案和解析
InterruptedException

相关考题:

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

下列程序的功能是在监控台上每隔一秒钟显示一个字符串“你好!”,能够填写在程序中画线位置,使程序完整并能正确运行的语句是 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

在Android中,可以使用Thread类的sleep()方法,让线程的休眠_________。

给你如下一段代码:你需要在类中编写更多的代码,用最少的资源每隔30秒去运行DoWork()方法() A.Thread.Sleep(30000)B.Thread.SpinWait(30000)C.Thread.QueueUserWorkItem(30000)D.Thread.SpinWait(30)

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

下列哪些方法是Thread类中所定义的方法?() A.yield()B.sleep(longmsec)C.go()D.stop()

5.classOrder2implementsRunnable{6.publicvoidrun(){7.for(intx=0;x〈4;x++){8.try{Thread.sleep(100);}catch(Exceptione){}9.System.out.print(r);10.}}11.publicstaticvoidmain(String[]args){12.Threadt=newThread(newOrder2());13.t.start();14.for(intx=0;x〈4;x++){15.//insertcodehere16.System.out.print(m);17.}}}哪一个插入到第15行,最有可能产生输出rmrmrmrm?()A.Thread.sleep(1);B.Thread.sleep(100);C.Thread.sleep(1000);D.try{Thread.sleep(100);}catch(Exceptione){}

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

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

下列程序的功能是在监控台上每隔-秒钟显示-个字符串”Hello!¨,能够填写在程序中下画线位置,使程序完整并能正确运行的语句是( )。A.sleep(1000)B.t. sleep(1000) InterruptedExceptionInterruptedExceptionC.Thread. sleep(1000)D.Thread. sleep(1000) RuntimeExceptionlnterruptedException

下列方法可以通过Thread类就可以调用,而不需要通过Thread类的实例进行调用的是 ( )A.sleep()B.start()C.setPriority()D.suspend()

判断下列语句哪个正确()。A、在线程休眠时,sleep方法会占用处理器时间B、将方法声明为synchronized,就可以确保不会发生死锁C、不提倡使用Thread类的suspend方法,resume方法和stop方法D、以上描述都正确

下列哪些方法是Thread 类中所定义的方法?()A、yield()B、sleep(long msec)C、go()D、stop()

下面哪个不是Thread类的方法?()A、yield()B、sleep(longmsec)C、go()D、stop()

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

下面方法不属于Thread类里面的是()A、run();B、sleep();C、wait();D、yield();

现有:   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、 运行时异常被抛出

下面()让线程休眠1分钟。 A、Thread.Sleep(1)B、Thread.Sleep(60)C、Thread.Sleep(1000)D、Thread.Sleep(60000)

5. class Order2 implements Runnable {  6. public void run() {  7. for(int x = 0; x 〈 4; x++) {  8. try { Thread.sleep(100); } catch (Exception e) { }  9. System.out.print("r");  10. } }  11. public static void main(String [] args) {  12. Thread t = new Thread(new Order2());  13. t.start();  14. for(int x = 0; x 〈 4; x++) {  15. // insert code here  16. System.out.print("m");  17. } } }  哪一个插入到第15行,最有可能产生输出 rmrmrmrm ?()  A、Thread.sleep(1);B、Thread.sleep(100);C、Thread.sleep(1000);D、try { Thread.sleep(100); } catch (Exception e) { }

单选题给你如下一段代码: 你需要在类中编写更多的代码,用最少的资源每隔30秒去运行DoWork( )方法()A Thread.Sleep(30000)B Thread.SpinWait(30000)C Thread.QueueUserWorkItem(30000)D Thread.SpinWait(30)

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

多选题Which two of statements are true?()AIt is possible to synchronize static methods.BWhen a thread has yielded as a result of yield(), it releases its locks.CWhen a thread is sleeping as a result of sleep(), it releases its locks.DThe Object.wait() method can be invoked only from a synchronized context.EThe Thread.sleep() method can be invoked only from a synchronized context.FWhen the thread scheduler receives a notify() request, and notifies a thread, that thread immediately releases its lock.

单选题判断下列语句哪个正确()。A在线程休眠时,sleep方法会占用处理器时间B将方法声明为synchronized,就可以确保不会发生死锁C不提倡使用Thread类的suspend方法,resume方法和stop方法D以上描述都正确

单选题现有:  5.  class Order2 implements Runnable  {     6.    public void run()  {     7. for (int x- o;  x4;  x++)  {  8. try{Thread.sleep(100);  )catch  (Exception e)  {  }     9.    System.out.print("r");     10.    }  }  11.    public static void main(string  []  args)  {     12.    Thread t=new Thread(new order2());     13.    t.start();  14.    for(int x=0;  x4;  x++)  {     15.    //insert code here     16.    System.out.print("m");     17.  }  }  }  哪一个插入到第15行,最有可能产生输出 rmrmrmrm?()A  Thread.sleep(1);B  Thread.sleep(100);C  Thread.sleep(1000);D  try{  Thread.sleep(1);  )  catch  (Exception e)  {  }E  try{Thread.sleep(100);  )  catch  (Exception  e)  {  }F  try{Thread.sleep(1000);  ) catch  (Exception  e)  { }

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

单选题在J2EE 中,VetoableChangeSupport的fireVetoableChange方法会抛出的异常是()。APropertyExceptionBPropertyVetoExceptionCVetoExceptionDPropertyChangeException

单选题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 运行时异常被抛出