-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
48 lines (37 loc) · 853 Bytes
/
Main.java
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
39
40
41
42
43
44
45
46
47
48
package BankingAppThreads;
public class Main {
public static void main(String[] args) {
final BankAccount account = new BankAccount(1000.000, "12345-678");
//Create and start thread
//
// Thread trThread1 = new Thread(){
// public void run(){
// account.deposit(300.00);
// account.withdraw(50.00);
// }
// };
//
// Thread trThread2 = new Thread() {
// public void run(){
// account.deposit(203.75);
// account.withdraw(100.00);
// }
// };
Thread trThread1 = new Thread(new Runnable() {
@Override
public void run() {
account.deposit(300.00);
account.withdraw(50.00);
}
});
Thread trThread2 = new Thread(new Runnable(){
@Override
public void run() {
account.deposit(203.75);
account.withdraw(100.00);
}
});
trThread1.start();
trThread2.start();
}
}