forked from Kotlin-Polytech/FromKotlinToJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
38 lines (32 loc) · 890 Bytes
/
Copy pathMain.java
File metadata and controls
38 lines (32 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package part4.deposit.sync;
import part4.deposit.naive.Deposit;
/**
*
* @author Eugene Pychkine
*/
@SuppressWarnings("Duplicates")
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Deposit deposit = new Deposit( 300 );
Client client = new Client( deposit, -100 );
Client bank = new Client( deposit, 1000 );
bank.start();
client.start();
try {
bank.join();
client.join();
int balance = deposit.getBalance();
System.out.println( "Balance at termination: " + balance );
}
catch( InterruptedException e ) {
System.out.println( "Unexpected");
}
}
}