下列程序创建了一个线程并运行,横线处应填入的正确代码是( )。 public class Try extends Thread{ public static void mai n(Stri ng args[]){ Thread t =ne w Try()

admin2012-12-02  52

问题 下列程序创建了一个线程并运行,横线处应填入的正确代码是(  )。
public class Try extends Thread{
public static void mai n(Stri ng args[]){
Thread t =ne w Try();
___________;

public void run(){
Syste m.out .pri ntln("Try !");


选项 A、t .start
B、t .class
C、t .thread
D、t .static

答案A

解析 start()是类Thread 的方法,其中start()方法用于启动线程,使之从新建状态转入就绪状态并进入就绪队列排队,一旦轮到它来享用CPU 资源时,就可以脱离创建它的主线程独立地开始自己的生命周期了。
转载请注明原文地址:https://kaotiyun.com/show/y9ID777K
0

最新回复(0)