()
| 22 | } |
| 23 | |
| 24 | public synchronized void get() { |
| 25 | if (!this.flag) { |
| 26 | try { |
| 27 | this.wait(); |
| 28 | } catch (InterruptedException e) { |
| 29 | e.printStackTrace(); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | System.out.println(this.name + "---" + this.age); |
| 34 | |
| 35 | this.flag = false; |
| 36 | this.notify(); |
| 37 | } |
| 38 | } |
no outgoing calls