题目内容 (请给出正确答案)
[单选题]

当一个线程t调用start后,即Threadtest t=new Threadtest().start,下面哪种描述是正确的 ()

A.该t线程立即开始执行run方法

B.该t线程执行完了run方法

C.该t线程处于不可运行状态,没有执行run方法

D.该t线程处于可运行状态,还没有执行run方法

查看答案
如搜索结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能会需要:
您的账号:
发送账号密码至手机
发送
更多“当一个线程t调用start后,即Threadtest t=n…”相关的问题

第1题

清阅读下面程序,说明该程序创建线程使用的方法是( )。 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()

点击查看答案

第2题

请阅读下面程序,说明该程序创建线程使用的方法是( )。 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.start

D.t2.start

点击查看答案

第3题

( 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 ()

点击查看答案

第4题

下面程序创建了一个线程并运行,请填空,使程序完整。

public class ThreadTest {

public static void main (String[] args) {

Hello h=Hew Hello ();

【 】

t.start ();

}

}

class Hello implements Runnable {

int i;

public void run () {

while(true) {

System.out.println("Hello" +i++);

if(i==5) break;

}

}

}

点击查看答案

第5题

下列程序创建了一个线程并运行,请填空,使程序完整。 public class ThreadTest{ public static void main(String args[]){ Hello h=new Hello(); 【 】; t.start (); } } class Hello implements Runnable{ int i; public void run(){ while(true){ System.out.println("Hello"+i++); if(i==5) break; } } }

点击查看答案

第6题

1下列程序创建了一个线程并运行,请填空,使程序完整。 public class ThreadTest { public static void main(String args[]){ Hello h=new Hello(); 【 】 ; t.start(); } } class Hello implements Runnable { int i; public void run() { while(tree){ System.out.println("Hello" +i++); if(i==5) break; } } }

点击查看答案

第7题

下面程序的功能是创建一个显示5个“Hello!”的线程并启动运行。请将程序补充完整。

public class ThreadTest extends Thread {

public static void main(String args[]) {

ThreadTest t=new ______;

t.start();

}

public void run() {

int i=0;

while(true) {

System.out.println("Hello!");

if(i++==4)break;

}

}

}

点击查看答案

第8题

下列程序通过设定线程优先级,抢占主线程的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)

点击查看答案

第9题

下列程序的运行结果是______。 Class C14 implements Runnable { private int i; public C14(int n) { this.i = n; } public void run{) { try { Thread.currentThread().sleep(i); } catch(InterruptedException ie) { System.err.println(ie.tString()); } System.out.println("线程" + Thread.currentThread() .getName + "睡眠了" + i + "毫秒结束"); } } public class Testl4 { public static void main(String[] args) { Thread t = new Thread(new C14(300), "t"); t.start(); } }

A.线程t睡眠了300毫秒结束

B.线程Thread-0睡眠了300毫秒结束

C.线程t睡眠了i毫秒结束

D.线程Thread-0睡眠了i毫秒结束

点击查看答案

第10题

对于下面语句的说法,不正确的是( )。Thread thrObj=new Thread( );

A.系统没有为该线程对象分配资源

B.只能启动或者终止

C.创建了-个空的线程对象

D.可以调用其他方法

点击查看答案
热门考试 全部 >
相关试卷 全部 >
账号:
你好,尊敬的上学吧用户
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
谢谢您的反馈

您认为本题答案有误,我们将认真、仔细核查,
如果您知道正确答案,欢迎您来纠错

警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

微信搜一搜
上学吧
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反上学吧购买须知被冻结。您可在“上学吧”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
上学吧
点击打开微信