在Thread类中,提供了一个start()方法,该方法用于(),当新线程启动后,系统会自动调用()方法
第1题:
Thread类中能运行线程体的方法是
A.start()
B.resume()
C.init()
D.run()
第2题:
请阅读下面程序 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()
第3题:
下列方法中,可以用来创建一个新线程的是______。
A.实现java.lang.Runnable接口并重写start( )方法
B.实现java.lang.Runnable接口并重写run( )方法
C.继承java.lang.Thread类并重写run( )方法
D.继承java.lang.Thread类并重写start( )方法
第4题:
Thread类中能运行线程的方法是( )。
A.resume( )
B.start( )
C.run( )
D.init( )
第5题:
A.通过Thread类的构造方法创建线程
B.Thread类提供了start()方法创建线程
C.通过实现Runnable接口创建线程
D.通过使用Thread类提供的interrupt()方法创建线程
第6题:
( 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 ()
第7题:
A.继承javlang.Thread并重写方法run
B.继承javlang.Runnable并重写start方法
C.实现javlang.thread并重写方法run
D.实现javlang.Thread并重写方法start
第8题:
( 25 ) Thread 类中能运行线程体的方法是
A ) start()
B ) resume()
C ) init()
D ) run()
第9题:
第10题:
阅读下列程序:class ThreadTest extends Thread{ public static void main(String[]args){ Thread t=new Thread(this); t.start(); } public void run(){ System.out.print("A thread test."); }} 对该程序而言,正确结论是 ( )
A.该程序能够通过编译并打印输出“A thread test.”
B.该程序能够通过编译,但运行时将不调用ThreadTest类中的run()方法,因此不产生任何输出
C.该程序存在编译错误,因为在main()方法中不能使用this指针
D.上述选项都不正确