Java Banking Codes
Java Banking Codes
Java Banking Codes
ReentrantLock;
class BankAccount {
private double balance;
private final ReentrantLock lock = new ReentrantLock();
////////////////////second codes////////////////////////////
class BankAccount {
private double balance;
depositThread1.start();
withdrawThread1.start();
depositThread2.start();
withdrawThread2.start();
try {
depositThread1.join();
withdrawThread1.join();
depositThread2.join();
withdrawThread2.join();
} catch (InterruptedException e) {
e.printStackTrace();
}