Java Topics
HubJava Collections FrameworkCollections Practice ProgramsComparable vs ComparatorGenericsIteratorArrayListLinkedListStackVectorHashMapHashtableLinkedHashMapTreeMapArrayDequeDeque Double-Ended QueuePriorityQueueHashSetLinkedHashSetTreeSetAdapter PatternBuilder PatternFactory PatternMVC PatternObserver PatternSingleton PatternDynamic ProgrammingGraphHashingHeapLinked List DSAQueue DSARecursionSearching AlgorithmsSorting AlgorithmsStack DSATime ComplexityTreesException Handling Best PracticesCustom ExceptionException Hierarchyfinally BlockException Handlingthrow aur throwstry-catchBuffered StreamsByte StreamsCharacter StreamsDeserializationFile ClassJava NIO New I/OSerializationArrays in JavaArray OperationsArray Practice ProgramsArray Interview QuestionsJagged ArrayMulti-Dimensional ArraysOne Dimensional Arraybreak aur continuedo-while Loopfor Loopif-else StatementsNested Loopsswitch-case Statementwhile LoopJava Compilation ProcessJava ki FeaturesPehla Java ProgramHistory of JavaJava EditionsJava Program StructureJDK, JRE aur JVMJava Kya Hai?Immutable StringsString Class in JavaString Interview QuestionsString MethodsString Practice ProgramsStringBufferStringBuilderComments in JavaData Types in JavaIdentifiers in JavaInput & Output in JavaJava KeywordsOperators in JavaType Casting in JavaVariables in JavaJava Coding Interview QuestionsCollections Interview QuestionsCore Java Interview QuestionsJDBC Interview QuestionsMultithreading Interview QuestionsOOPs Interview QuestionsSpring Framework Interview QuestionsJava 8 Date/Time APIDefault aur Static Methods in InterfaceFunctional InterfaceLambda ExpressionMethod ReferenceOptional ClassStream APIBatch ProcessingCallableStatementJDBC ArchitectureJDBC — Java Database ConnectivityJDBC Practice ProjectsMySQL ConnectionPreparedStatementResultSetStatement InterfaceTransaction ManagementCreating ThreadsDaemon ThreadExecutor FrameworkInter-Thread CommunicationMultithreading Practice ProgramsRunnable InterfaceSynchronizationThread ClassMultithreading IntroductionThread Life CycleThread PriorityJava Cheat SheetImportant Formulas & Key ConceptsImportant Java ProgramsJava Quick RevisionAbstract ClassAbstractionAnonymous ClassClass and ObjectConstructorEncapsulationInheritanceInner ClassInterfaceMethod OverloadingMethod OverridingObject ClassObject CloningObject-Oriented Programming OOPPolymorphismstatic Keywordsuper Keywordthis KeywordWrapper ClassesArray Practice ProgramsBasic Java Practice ProgramsCollection Practice ProgramsJDBC Practice ProgramsMultithreading Practice ProgramsOOPs Practice ProgramsPlacement Coding QuestionsString Practice ProgramsBanking SystemChat ApplicationE-Commerce Backend — Spring Boot REST APIEmployee Management SystemLibrary Management SystemSpring Boot Fullstack ProjectStudent Management SystemCookies in ServletExpression Language ELGenericServletHttpServletJavaServer Pages JSPJSP TagsMVC ArchitectureHttpServletRequest & HttpServletResponseServlet IntroductionServlet Life CycleSession TrackingDependency InjectionSpring BeansSpring CoreSpring FrameworkAPI GatewaySpring Cloud Config ServerDocker DeploymentEureka Server — Service DiscoverySpring Boot CRUD ApplicationException Handling in Spring BootJWT AuthenticationREST API in Spring BootSpring SecuritySpring BootSpring Data JPAValidation in Spring Boot
Banking System
Last Updated : 26 May, 2026
title: Banking System
Projects59 words5 headingsExamples included
title: Banking System description: Java se Console-based Banking System
Account management, transactions, aur fund transfer ka system.
Features
- Account create karna (Savings / Current)
- Deposit aur Withdrawal
- Fund Transfer between accounts
- Transaction history dekhna
- Balance check karna
- Interest calculate karna
Technology Stack
- Java SE 17+
- JDBC
- MySQL
- Transaction Management
Database Setup
sql exampleWoHoTech
CREATE DATABASE banking_db;
USE banking_db;
CREATE TABLE accounts (
id INT PRIMARY KEY AUTO_INCREMENT,
account_number VARCHAR(20) UNIQUE NOT NULL,
holder_name VARCHAR(100) NOT NULL,
account_type ENUM('SAVINGS','CURRENT') DEFAULT 'SAVINGS',
balance DOUBLE DEFAULT 0,
is_active BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE transactions (
id INT PRIMARY KEY AUTO_INCREMENT,
account_number VARCHAR(20),
type ENUM('DEPOSIT','WITHDRAWAL','TRANSFER_IN','TRANSFER_OUT'),
amount DOUBLE,
balance_after DOUBLE,
description VARCHAR(200),
transaction_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (account_number) REFERENCES accounts(account_number)
);Account Model
java exampleWoHoTech
package model;
public class Account {
private int id;
private String accountNumber;
private String holderName;
private String accountType;
private double balance;
private boolean isActive;
public Account() {}
public Account(String holderName, String accountType, double initialBalance) {
this.holderName = holderName;
this.accountType = accountType;
this.balance = initialBalance;
this.accountNumber = generateAccountNumber();
this.isActive = true;
}
private String generateAccountNumber() {
return "ACC" + System.currentTimeMillis() % 10000000;
}
// Getters aur Setters
public int getId() { return id; }
public void setId(int id) { this.id = id; }
public String getAccountNumber() { return accountNumber; }
public void setAccountNumber(String accountNumber) { this.accountNumber = accountNumber; }
public String getHolderName() { return holderName; }
public void setHolderName(String holderName) { this.holderName = holderName; }
public String getAccountType() { return accountType; }
public void setAccountType(String accountType) { this.accountType = accountType; }
public double getBalance() { return balance; }
public void setBalance(double balance) { this.balance = balance; }
public boolean isActive() { return isActive; }
public void setActive(boolean active) { isActive = active; }
@Override
public String toString() {
return String.format("Account: %s | Holder: %s | Type: %s | Balance: Rs.%.2f | Status: %s",
accountNumber, holderName, accountType, balance, isActive ? "Active" : "Inactive");
}
}BankingService — Core Logic
java exampleWoHoTech
package service;
import dao.*;
import model.*;
import util.DBConnection;
import java.sql.Connection;
public class BankingService {
private AccountDAO accountDAO = new AccountDAO();
private TransactionDAO transactionDAO = new TransactionDAO();
public Account createAccount(String name, String type, double initialDeposit) throws Exception {
if (initialDeposit < 500) throw new Exception("Minimum initial deposit Rs.500");
Account acc = new Account(name, type, initialDeposit);
accountDAO.insert(acc);
transactionDAO.insert(acc.getAccountNumber(), "DEPOSIT", initialDeposit,
initialDeposit, "Account opening deposit");
return acc;
}
public double deposit(String accNum, double amount) throws Exception {
if (amount <= 0) throw new Exception("Invalid deposit amount");
Account acc = accountDAO.findByNumber(accNum)
.orElseThrow(() -> new Exception("Account not found"));
if (!acc.isActive()) throw new Exception("Account is inactive");
double newBalance = acc.getBalance() + amount;
accountDAO.updateBalance(accNum, newBalance);
transactionDAO.insert(accNum, "DEPOSIT", amount, newBalance, "Cash deposit");
return newBalance;
}
public double withdraw(String accNum, double amount) throws Exception {
if (amount <= 0) throw new Exception("Invalid amount");
Account acc = accountDAO.findByNumber(accNum)
.orElseThrow(() -> new Exception("Account not found"));
if (!acc.isActive()) throw new Exception("Account is inactive");
if (acc.getBalance() < amount) throw new Exception("Insufficient balance");
double minBalance = acc.getAccountType().equals("SAVINGS") ? 500 : 1000;
if (acc.getBalance() - amount < minBalance)
throw new Exception("Minimum balance Rs." + minBalance + " maintain karna jaruri hai");
double newBalance = acc.getBalance() - amount;
accountDAO.updateBalance(accNum, newBalance);
transactionDAO.insert(accNum, "WITHDRAWAL", amount, newBalance, "Cash withdrawal");
return newBalance;
}
public void transfer(String fromAcc, String toAcc, double amount) throws Exception {
if (amount <= 0) throw new Exception("Invalid amount");
try (Connection conn = DBConnection.getConnection()) {
conn.setAutoCommit(false);
try {
Account from = accountDAO.findByNumber(fromAcc)
.orElseThrow(() -> new Exception("Source account not found"));
Account to = accountDAO.findByNumber(toAcc)
.orElseThrow(() -> new Exception("Destination account not found"));
if (from.getBalance() < amount)
throw new Exception("Insufficient balance");
double newFromBalance = from.getBalance() - amount;
double newToBalance = to.getBalance() + amount;
accountDAO.updateBalance(fromAcc, newFromBalance);
accountDAO.updateBalance(toAcc, newToBalance);
transactionDAO.insert(fromAcc, "TRANSFER_OUT", amount, newFromBalance,
"Transfer to " + toAcc);
transactionDAO.insert(toAcc, "TRANSFER_IN", amount, newToBalance,
"Transfer from " + fromAcc);
conn.commit();
System.out.println("Transfer successful! Rs." + amount + " transferred.");
} catch (Exception e) {
conn.rollback();
throw e;
}
}
}
}Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Banking System.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Java topic.
Search Terms
java, java programming, core java, java master course, java notes, master, course, projects
Related Java Topics
Continue learning this concept
ProjectsEmployee Management Systemtitle: Employee Management SystemProjectsLibrary Management Systemtitle: Library Management SystemProjectsStudent Management Systemtitle: Student Management SystemProjectsChat Applicationtitle: Chat ApplicationProjectsE-Commerce Backend — Spring Boot REST APItitle: E-Commerce BackendProjectsSpring Boot Fullstack Projecttitle: Spring Boot Fullstack Project