在程序的下面线处应填入的选项是______。
public class Test______
public static void main(String args[])
Test t=new Test( );
Thread tt=new Thread(t);
tt. start( );
public void run( )
for(int i=0; i<5; i++)
System. out. println("i="+i);
A:implements Runnable B:extends Thread C:implements Thread D:extends Runnable
在程序的下画线处应填入的选项是( )。
public class Test______
public static void main(String args[])
Test t=new Test( );
Thread tt=new Thread(t);
tt.start( );
public void run( )
for(int i=0;i<5;i++)
System.out.println("i="+i);
A:implements Runnable B:extends Thread C:implements Thread D:extends Runnable
下列程序的执行结果是______。
class A5 extends Thread
boolean b;
A5 (boolean bb)
b = bb;
public void run( )
System.out.println(this.getName( ) + "运行");
public class Testl5
public static void main(String[] args)
A5 a1 = new A5(true);
A5 a2 = new A5(false);
if(a1.b)
A1. start( );
if (a2 .b)
A2.start( );
A:Thread-0 B:Thread-1 C:Thread-0 D:Thread-1
Thread-1 Thread-0
下列程序通过设定线程优先级,抢占主线程的CPU,选择正确的语句填入横线处。
class T14 implements Runnable
private Boolean fStop - true;
public void run( )
while(fStop)
System.out.println(Thread.currentThread( ).getName( ) + "run");
try
Thread.sleep(l);
catch(Exception e)
e.printStackTrace( );
public void stopRun( )
fStop = false;
public class Testl4
public static void main(String[] args)
T14 t14 = new T14( );
Thread t1 = new Thread(ti4, "T14");
Thread t = Thread.currentThread( )’;
______;
Ti.start( );
T14.stopRun( );
System.out.println ( "stop ");
A:setPriority(Thread. MIN_PRIORITY) B:t1 .setPriority(Thread. MIN_PRIORITY) C:t.setPfiofity(Thread. MIN_PRIORITY) D:t14.setPriority(Thread. MIN_PRIORITY)
在下面程序的下画线处应填入的选项是
public class Test______
public static void main(String args[])
Test t=new Test( );
Thread tt=new Thread(t);
tt.start( );
public void run( )
for(int i=0;i<5;i++) System.out.println("i="+i);
A:implements Runnable B:extends Thread C:implements Thread D:extends Runnable
下列程序的执行结果是______。 class A5 extends Thread { boolean b; A5 (boolean bb) { b = bb; } public void run( ) { System.out.println(this.getName( ) + "运行"); } } public class Testl5 { public static void main(String[] args) { A5 a1 = new A5(true); A5 a2 = new A5(false); if(a1.b) A1. start( ); if (a2 .b) A2.start( ); } }
A:Thread-0 B:Thread-1 C:Thread-0 D:Thread-1 Thread-1 Thread-0
下列关于Thread类的说法中,错误的一项是______。
A:任何实现Runnable接口的对象都可以作为Thread类构造方法的target参数 B:name参数若为null,Java会给线程赋予一个惟一的名称 C:Thread类本身没有实现Runnable接口 D:当线程启动时,target参数表示的对象的run()方法将被调用
在下面程序的下画线处应填入的选项是 public class Test______{ public static void main(String args[]) { Test t=new Test( ); Thread tt=new Thread(t); tt.start( ); } public void run( ) { for(int i=0;i<5;i++) System.out.println("i="+i); } }
A:implements Runnable B:extends Thread C:implements Thread D:extends Runnable
在程序的下划线处应填入的选项是()
public class Test_____{
public static void main(String args[]){
Test t = new Test( );
Thread tt = new Thread(t);
tt.start( );
}
public void run( ){
for(int i=0;i<5;i++){
system.out.println("i="+i);
}
}
}
A:implements Runnable B:extends Thread C:implements Thread D:extends Runnable