一个JAVA的多线程问题 新手求大神

2025-04-15 15:48:25
推荐回答(1个)
回答1:

new Thread(new Runnable(){ void run(){
long start=system.currenttime();

Double Money=A.showM();//200
long end=system.currenttime();
do{
end=system.currenttime();

}while(2000==end-start)

A.addM(100);

}}).start();

new Thread(new Runnable(){ void run(){
long start=system.currenttime();

Double Money=B.showM();//300
long end=system.currenttime();
do{
end=system.currenttime();

}while(2000==end-start)

A.getM(50);

}}).start();