Java多线程练习题.docxVIP

  • 101
  • 0
  • 约8.21千字
  • 约 24页
  • 2020-04-05 发布于湖南
  • 举报
Java多线程习题 一、选择题 什么原因可导致线程停止执行。( ) 线程调用了wait()方法; 线程调用了yield()方法; 线程调用了pause()方法; 线程调用了sleep()方法。 哪个方法是实现Runnable接口所需的?( ) A. wait() B.run() C.stop() D.update() E.resume() 以下代码的调试结果为( ) publicclassBgroundextendsThread{ publicstaticvoidmain(Stringargv[]){ Bgroundb=newBground();b.run(); } publicvoidstart(){ for(inti=0;i10;i++){ System.out.println(Valueofi=+i); } }} 编译错误,没有定义线程的run方法 由于没有定义线程的run方法,而出现运行错误 编译通过,运行输出values0to9 编译通过,运行无输出 编写线程类,要继承的父类是( ) A. Object B. Runnable C. Serializable D. Thread E. Exception 编写线程类,可以通过实现那个接口来实现? A. Runnable B. Throwable C. Serializable D. Comparable

文档评论(0)

1亿VIP精品文档

相关文档