首页 > 试题广场 >

阅读下列程序,写出程序运行结果。 public cl

[问答题]

阅读下列程序,写出程序运行结果。

public class Test_l

{  public static void main (String args[ ])

{  Lefthand left;

Righthand right;

left=new Lefthand() ;

right=new Righthand ();

left.start ();

right.start () ;

}

}

class Lefthand extends Thread

{  public void run()

{  for ( int i=l; i<=5; i++)

{ System.out .print ("A");

try {

sleep (500) ;

}

catch (InterruptedException e){}

}

}

}

class Righthand extends Thread

{  public void run()

{  for ( int i=l; i<=5; i++)

{  System.out.print ("B");

try {

sleep (300) ;

}

catch (InterruptedException e){}

}

}

}

我运行的结果:ABBABBABAA  500 300 300 500.。。。。。。
编辑于 2018-04-02 15:24:07 回复(0)
不是,这个结果是唯一的?
发表于 2017-12-11 19:07:39 回复(0)