网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
请阅读下面程序,说明该程序创建线程使用的方法是( )。
A.继承Thread类
B.实现Runnable接口
C.tl.start( )
D.t2.start( )
参考答案
更多 “ 请阅读下面程序,说明该程序创建线程使用的方法是( )。A.继承Thread类B.实现Runnable接口C.tl.start( )D.t2.start( ) ” 相关考题
考题
( 24 )请阅读下面程序public class ThreadTest {public static void main ( String args[ ]){Thread t1 = new Thread ( new Hello ()):Thread t2 = new Thread ( new Hello ()):t l .start ():t2.start ();}}class Hello implements Runnable {int i ;public void run (){while ( true ) {System.out.println ( "Hello"+i++ ) ;if ( i=5 ) break :}}}该程序创建线程使用的方法是()A )继承 Thread 类B )实现 Runnable 接口C ) t l.start ()D ) t2.start ()
考题
请阅读下面程序 public class ThreadTest{ public static void main(String args[]) ( Thread t1=new Thread(new Hello()); Thread t2=new Thread(new Hello()); t1.start(); t2.start(); } } class Hello implements Runnable { int i; public void run() { while(true) { System.out.prinfin("Hello"+i++); if(i=5) break; } } } 该程序创建线程使用的方法是A.继承Thread类B.实现Runnable接口C.t1.start()D.t2.start()
考题
怎样创建线程()
A.通过Thread类的构造方法创建线程B.Thread类提供了start()方法创建线程C.通过实现Runnable接口创建线程D.通过使用Thread类提供的interrupt()方法创建线程
考题
创建线程有两种方法,一种是继承线程类Thread,另一种是______。A.建立实现Runnable接口的类B.直接创建线程即可,无需实现任何接口C.建立实现Collection接口的类D.建立实现Thread接口的类
考题
清阅读下面程序,说明该程序创建线程使用的方法是( )。 publicclassThreadTest { publicstaticvoidmain(Stringargs[]) { Threadt1=newThread(newHolloWorld()); Threadt2=newThread(newHolloWorld()); t1.start(); t2.start(); } } classHolloWorldimplementsRunnable { inti; publicvoidrun() { while(true) { System.out.println("HolloWorld"+i++); if(i==5)break; } } }A.继承Thread类B.实现Runnable接口C.t1.start()D.t2.stan()
考题
请阅读下面程序,说明该程序创建线程使用的方法是( )。 public class ThreadTest { public static void main(String args[]) { Thread tl=new Thread(new HolloWorld); Thread t2=new Thread(new HolloWorld); tl.start; t2.Start; } } class HolloWorld implements Runnable { int i; public void run { while(true) { System.out.println("HolloWorld"+i++); if(i= =5)break; } } }A.继承Thread类B.实现Runnable接口C.tl.startD.t2.start
考题
下列说法中错误的一项是 ( )A.使用继承Thread类创建线程,可以直接调用线程的方法B.通过实现Runnable接口创建线程,体现了面向对象的思想C.Thread类从面向对象的角度看,是虚拟CPU的封装D.通过实现Runnable接口创建线程,会影响Thread类的体系
考题
下列说法中,错误的一项是()。A.Thread类中没有定义run()方法B.可以通过继承Thread类来创建线程C.Runnable接口中定义了run()方法D.可以通过实现Runnable接口创建线程
考题
实现Runnable接口比继承Thread类创建线程的方式扩展性更好。()
热门标签
最新试卷