问答题
public class ex35_2
{
public static void main(String args[ ])
{
Runnable b1=new B("First");
Runnable b2=new B("Second");
Runnable b3=new B("Third");
Thread t1=new Thread(b1);
Thread t2=new Thread(b2);
Thread t3=new Thread(b3);
t1.start ();
t2.start ();
t3.start();
}
}
class B _____________________ Runnable
{
String s;
public B(String str)
{
s=str;
}
_________________
{
for(int i=1;i<3;i++)
{
System. out. println ( s+ "运行!");
try
{
Thread.sleep((int) (Math.random() *100) );
}
catch (InterruptedException e)
{
e.printStackTrace ( );
}
}
System. out.println (s+"结束!");
}
}