Java一个线程如何调用另一个线程的数据,A线程生成随机数,B线程判断A线程生成随机的奇偶
classAimplementsRunnable{publicvoidrun(){Randomr=newRandom();inta;for(inti=0;i<90;i++...
class A implements Runnable
{
public void run(){
Random r=new Random();
int a;
for (int i = 0; i < 90; i++)
{
a=r.nextInt(100);
System.out.print(a + " ");
}
}
}
class B implements Runnable
{
//这里怎么写
} 展开
{
public void run(){
Random r=new Random();
int a;
for (int i = 0; i < 90; i++)
{
a=r.nextInt(100);
System.out.print(a + " ");
}
}
}
class B implements Runnable
{
//这里怎么写
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询