计算机二级

( 18 )阅读下列程序Public class Test implements Runnable{Private int x=0;Private int y=o;boolean flag=true;Public static void main(string[ ] args) {Test r =new Test( );Thead t1=new Thead(r);Thead t2=new Thead(r);t1.start( );t2.start( );}Public void run(){While(f

题目

( 18 )阅读下列程序

Public class Test implements Runnable{

Private int x=0;

Private int y=o;

boolean flag=true;

Public static void main(string[ ] args) {

Test r =new Test( );

Thead t1=new Thead(r);

Thead t2=new Thead(r);

t1.start( );

t2.start( );

}

Public void run(){

While(flag) {

x++;

y++;

system.out.println( “ ( ” +x_ “ , ” +y+ ” ) ” );

if (x>=10)

flag=false;

}

}

}

下列对程序运行结果描述的选项中,正确的是

A)每行的( x,y )中,可能有;每一对( x,y )值都出现两次。

B)每行的( x,y )中,可能有;每一对( x,y )值仅出现一次。

C)每行的( x,y )中,可能有 x=y ;每一对( x,y )值都出现两次。

D)每行的( x,y )中,可能有 x=y ;每一对( x,y )值都出现一次。

如果没有搜索结果,请直接 联系老师 获取答案。
更多相关问题