public class Main {     public static volatile Integer acount=0;     public static Object lock = new Object();     public static void main(String[] args){         new Thread(()->{                 del(30);         }).start();         new Thread(()->{             for (int i = 0; i < 6; i++) {                 add(5);             }         }).start();     }     public static void add(int num){         synchronized(lock){             acount+=num;             System.out.println("存款:"+num);             lock.notify();         }     }     public static void del(int num){         synchronized(lock){             while (acount<num){                 try {                     lock.wait();                     System.out.println("余额不足:"+acount);                 } catch (InterruptedException e) {                 }             }             acount-=num;             System.out.println("取款:"+num);         }     } }