public static void main(String[] args) {
/*、模拟两个人向银行存钱,每次存300,两个人总共存十次*/
MyRunnable tr = new MyRunnable();
new Thread(tr,"张三").start();
new Thread(tr,"李四").start();
}
}
class MyRunnable implements Runnable{
private int money = 300; //一次存多少钱
private int num = 10;// 存了多少次 1-10
private int sum; //一共存了多少钱