[单选题]

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

参考答案与解析:

相关试题

阅读下面程序1public class Try extends Thread{

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

  • 查看答案
  • 阅读下面程序1public class Try extends Thread{2

    [单选题]阅读下面程序 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行“祝你成功!”,必须改正程

  • 查看答案
  • 阅读下面程序1public class Try extends Thread{2

    [单选题]阅读下面程序 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行“祝你成功!”,必须改正程

  • 查看答案
  • 阅读下面程序1 public class Try extends Thread

    [单选题]阅读下面程序 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行“祝你成功!”

  • 查看答案
  • ( 28 )阅读下面程序1 public class Try extends T

    [单选题]( 28 )阅读下面程序1 public class Try extends Thread{2 public static void main(String args[ ]){3 Try t = new Try( );4 t.start( );5 }67 public void run( int j){8 int i = 0;9 while(i<5){10 System.out.println(" 祝你成功! ");11 i++;12 }13 }14 }该程序要求打印 5 行 “ 祝你

  • 查看答案
  • 阅读下列程序:class ThreadTest extends Thread{p

    [单选题]阅读下列程序: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.该程序能够通过编译,但运行时将不调用Thr

  • 查看答案
  • 阅读下面程序public void test() { try{ sayHello

    [单选题]阅读下面程序 public void test() { try{ sayHello(); System.out.println("hello"); } catch(ArrayIndexOutOfBoundException e) { System.out.println("ArrayIndexOutOfBoundException"); } catch(Exception e) { System.out.println("Exception"); } finally { System

  • 查看答案
  • 阅读下面程序 public class Test3 { public stati

    [单选题]阅读下面程序 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.xyzl2B.xyz345C.xyzxyzD.12xyz

  • 查看答案
  • 阅读下面程序public class Test3 { public static

    [单选题]阅读下面程序 public class Test3 { public static void main(String[] args) { int x=3,y=4,z=5; String s="xyz": System.out.println(s+x+y+z); } } 程序运行的结果是A.xyz12B.xyz345C.xyzxyzD.12xyz

  • 查看答案
  • 阅读下面程序 public class Test3 { public stati

    [单选题]阅读下面程序 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.xyzl2B.xyz345C.xyzxyzD.12xyz

  • 查看答案
  • 3阅读下面程序1public class Try extends Thread{