首页 > 计算机等级考试
题目内容 (请给出正确答案)
[主观题]

阅读下面程序public class Test2______ {public static void main(String[] args){Thread t=new

阅读下面程序 public class Test2______ { public static void main(String[] args){ Thread t=new Test2(); t. start(); } public void run(){ System. out. priatln("How are you. "); } } 在程序下画线处填入的正确的选项是

A.implements Thread

B.extends Runnable

C.implements Runnable

D.extends Thread

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“阅读下面程序public class Test2______…”相关的问题
第1题
阅读下面程序public class Test2______ {public static void main(String[] args){Thread t=new

阅读下面程序 public class Test2______ { public static void main(String[] args){ Thread t=new Test2(); t. start(); } public void run(){ System. out. priatln("How are you. "); } } 在程序下画线处填入的正确的选项是

A.implements Thread

B.extends Runnable

C.implements Runnable

D.extends Thread

点击查看答案
第2题
(24 )请阅读下面程序public class ThreadTest {public static void main (String args[ ]){Thr

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

点击查看答案
第3题
(28 )请阅读下面程序public class ThreadTest {public static void main (String args[ ]) thr

(28 )请阅读下面程序

public class ThreadTest {

public static void main (String args[ ]) throws Exception {

int i=0;

Hello t = new Hello ();

___________;

whlle (true ){

System.out.println ("Good Morning"+i++ ) ;

if (i=2 && t.isAlive ()){

System.out.println ("Main waiting for Hello ! ” );

tjoin () ; // 等待 t 运行结束

if (i==5 ) break :}

}

class Hello extends Thread {

int i ;

public void run ()笼

while (true ){

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

if (i=5 ) break ;}}}

为使该程序正确执行,下划线处的语句应是

A ) t.sleep ()

B ) t.yieldn ()

C ) t.interrupt ()

D ) t.start ()

点击查看答案
第4题
阅读下面程序1public class Try extends Thread{2public static void main(String args[]){3Try

阅读下面程序 1 public class Try extends Thread{ 2 public static void main(String args[]){ 3 Try t=new Try(); 4 t.start(); 5 } 6 7 public void run(int j){ 8 int i=0; 9 while(i<5){ 10 System.out.println(“祝你成功!”); 11 i++; 12 } 13 } 14 } 该程序要求打印5行“祝你成功!”,必须改正程序中的某行代码,程序才能完成。选择正确的修改是

A.将第1行的extends Thread改为implements Runnable

B.将第3行的new Try()改为new Thread()

C.将第4行t.start()改为start(t)

D.将第7行的public void run(int j)改为public void run()

点击查看答案
第5题
阅读下面程序1public class Try extends Thread{2public static void main(String args[]){3Try

阅读下面程序 1 public class Try extends Thread{ 2 public static void main(String args[]){ 3 Try t=new Try(); 4 t.start(); 5 } 6 7 public void run(int j){ 8 int i=0; 9 while(i<5){ 10 System.out.println(“祝你成功!”); 11 i++; 12 } 13 } 14 } 该程序要求打印5行“祝你成功!”,必须改正程序中的某行代码,程序才能完成。选择正确的修改是

A.将第1行的extends Thread改为implements Runnable

B.将第3行的new Try()改为new Thread()

C.将第4行t.start()改为start(t)

D.将第7行的public void run(int j)改为public void run()

点击查看答案
第6题
阅读下面程序 1 public class Try extends Thread{ 2 public static void main(String args[]

阅读下面程序 1 public class Try extends Thread{ 2 public static void main(String args[]){ 3Try t=new Try; 4 t.start; 5} 6 7 public void run(intj){ 8 inti=0; 9 while(i<5){ 10 System.out.println("祝你成功!"); 11 i++: 12} 13} 14} 该程序要求打印5行"祝你成功!",必须改正程序中的某行代码,程序才能完成。选择正确的修改是()。

A.将第1行的extendsThread改为implementsRunnable

B.将第3行的newTry改为newThread

C.将第4行t.start改为start(t)

D.将第7行的public void run(intj)改为public void run

点击查看答案
第7题
阅读下面程序1 public class Try extends Thread {2 public static void main(String args[]) {3

阅读下面程序 1 public class Try extends Thread { 2 public static void main(String args[]) { 3 Try t=new Try(); 4 t.start(); 5 } 6 7 public void run(int j) { 8 int i=0; 9 while(i<5) { 10 System.out.println("祝你成功!"); 11 i++: 12 } 13 } 14 } 该程序若能打印5行“祝你成功!”,必须改正程序中的某行代码,选择正确的修改是

A.将第1行的extends Thread改为implements Runnable

B.将第3行的new Try()改为new Thread()

C.将第4行的t.start()改为start(t)

D.将第7行的public void run(int j)改为public void run()

点击查看答案
第8题
3阅读下面程序1public class Try extends Thread{ 2public static void main(String args[ ]){ 3

3阅读下面程序 1 public class Try extends Thread{ 2 public static void main(String args[ ]){ 3 Try t = new Try(); 4 t.start(); 5 } 6 7 public void run(int j){ 8 int i = 0; 9 while(i<5) { 10 System.out.pfintln("祝你成功"); 11 i++; 12 } 13 } 14 } 该程序要求打印5行“祝你成功”必须改正程序中的某行代码,程序才能完成。选择正确的修改是()。

A.将第1行的extends Thread改为implements Runnable

B.将第3行的new Try()改为new Thread()

C.将第4行t.sta.rt()改为start(t)

D.将第7行的publ void run(int j)改为public void run()

点击查看答案
第9题
阅读下面程序 public class Test3 { public static void main(String args[]){ int x=3, y=4, z=

阅读下面程序 public class Test3 { public static void main(String args[]){ int x=3, y=4, z=5; String s="xyz"; System.out.primln(s+x+y+z); } } 程序运行的结果是

A.xyzl2

B.xyz345

C.xyzxyz

D.12xyz

点击查看答案
第10题
阅读下面程序public class Test2 {public static void main(String args[]){ int a=1O, b=4, c=

阅读下面程序 public class Test2 { public static void main(String args[]){ int a=1O, b=4, c=20, d=6; System.out.println(a++*b+c*--D) ; } } 程序运行的结果是

A.144

B.160

C.140

D.164

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改