teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

コードの修正

2020/07/13 04:21

投稿

grape_ll
grape_ll

スコア83

title CHANGED
File without changes
body CHANGED
@@ -14,13 +14,13 @@
14
14
  synchronized(this){
15
15
  System.out.println("Transferring "+amount+" from "+name);
16
16
  Thread.sleep(100);
17
- // synchronized(other){
17
+ synchronized(other){
18
18
  if(amount>value) System.out.println("Not enough money");
19
19
  else{
20
20
  other.value=other.value+amount;
21
21
  this.value-=amount;
22
22
  }
23
- //}
23
+ }
24
24
  }
25
25
  }
26
26
  }