public class ThreadTest {
public static void main ( String args[ ]) throws Exception {
int i=0;
H.ello 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 ()
[单选题]( 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
[单选题]请阅读下面程序 public class ThreadTest { public static void main(String args[]) throws Exception{ int i=0; Hello t=new Hello(); while(true) { System.out.println("Good Moming"+i++); if (i==2 && t.isAlive()) { System. out.println("Main waiting for
[单选题]请阅读下面程序 public class ThreadTest { public static void main(String args[]) throws Exception{ int i=0; Hello t=new Hello(); while(true) { System.out.println("Good Moming"+i++); if (i==2 && t.isAlive()) { System. out.println("Main waiting for
[单选题]请阅读下面程序 public class ThreadTest{ public static void main(String args[]) ( Thread t1=new Thread(new Hello()); Thread t2=new Thread(new Hello()); t1.start(); t2.start(); } } class Hello implements Runnable { int i; public void run() { while(true) { Sys
[单选题]请阅读下面程序 public class ThreadTest{ public static void main(String args[]) ( Thread t1=new Thread(new Hello()); Thread t2=new Thread(new Hello()); t1.start(); t2.start(); } } class Hello implements Runnable { int i; public void run() { while(true) { Sys
[单选题]阅读下面程序: public class ThreadTest { public static void main(String args[]) throws Exception { int i=0; Hello t=new Hello(); ______; While(true) } System.out.println("Good Morning"+i++); if(i==2&&t.isAlive()) { System.out.println("Main waitin
[单选题]请阅读下面程序 public class ForLoopStatement { public static void main(string []args){ int i,j; for (i=1; i<5; i++) { //i循环 for (j=1;j<=i;j++) //j循环 System.out.print(i+"×"+j+"="+i*j+" "); System.out.println(); } } } 程序完成后,i循环和j循环执行的次数分别是A.4,10B.8,9C.9
[单选题]请阅读下面程序 public class ForLoopStatement { public static void main(string []args){ int i,j; for (i=1; i<5; i++) { //i循环 for (j=1;j<=i;j++) //j循环 System.out.print(i+"×"+j+"="+i*j+" "); System.out.println(); } } } 程序完成后,i循环和j循环执行的次数分别是A.4,10B.8,9C.9
[单选题]阅读下面程序 public class ForLoopStatement { public static void main(String[] args) { int i,j; for(i=1;i<5;i++){ //i循环 for(j=1;j<=i;j++)System.out.print(i+"*"+j+"="+i*j+" "); //j循环 System.out.println(); } } } 程序完成后,i循环和J循环执行的次数分别是A.4,10B. 8,9C.9,8D.1
[单选题]阅读下面程序 public cmass ThreadTest { public static void main(String args[]) { Thread t1=new Thread(new Hello()); Thread t2=new Thread(new Hello()); t1.start(); t2.start(); } } class Hello implements Runnable { int i; public void run() { while(true) { Sys