A clean, modular, and menu-driven Inventory Management System developed in Java to demonstrate fundamental Object-Oriented Programming (OOP) principles, dynamic collections, defensive input parsing, and complete CRUD (Create, Read, Update, Delete) operations.
Note: This is an educational portfolio project designed to illustrate software design patterns and OOP concepts in Java. It is a console-based application built for learning and demonstration.
- Overview
- Features
- OOP Concepts Used
- Java Concepts Used
- Technologies Used
- Project Structure
- CRUD Operations
- Data Storage
- How to Run
- Usage & Menu Options
- Sample Output
- Screenshots
- Limitations
- Future Improvements
- Learning Outcomes
- License
The Java/OOP Inventory Management System is a console-based application that simulates real-world retail and warehouse product tracking. It enables users to register new products, inspect live inventory tables with automated stock-level calculations, search items by ID or name, modify product attributes, remove discontinued stock, and generate low-stock alert reports with total inventory valuations.
- Add New Products: Captures Product ID, Name, Category, Unit Price, and Quantity with duplicate ID prevention and non-negative constraints.
- Tabular Inventory Ledger: Formats all registered products in an aligned table showing Unit Price, Quantity, Total Valuation, and Stock Health.
- Real-Time Stock Status: Dynamically flags items as
In Stock(>5 units),Low Stock(1–5 units), orOut of Stock(0 units). - Dual Search Capabilities:
- Search by Product ID: Exact lookup returning detailed product card view.
- Search by Name/Keyword: Case-insensitive substring matching across the inventory.
- Selective Product Updates: Modifies Name, Category, Price, or Stock Quantity while retaining untouched fields.
- Safe Product Deletion: Removes items after interactive confirmation (
Y/N). - Low Stock & Reorder Alerts: Generates dedicated reports listing all items requiring immediate procurement.
- Inventory Valuation Metrics: Automatically aggregates total unique product lines, total physical units in stock, and grand total monetary value.
- Defensive Input Handling: Uses custom input reader routines to prevent program crashes from
NumberFormatExceptionor scanner buffer mismatches.
This project was architected to demonstrate core Object-Oriented Programming principles in Java:
ProductClass: Models the entity with attributes (id,name,category,price,quantity) and behaviors (getTotalValue(),getStockStatus()).InventoryClass: Manages the collection ofProductobjects, encapsulating all search, aggregation, and mutation routines.MainClass: Orchestrates user interactions, menus, and program lifecycle.
- All fields in
ProductandInventoryare declaredprivateto prevent direct external manipulation. - Controlled access is provided through
publicgetter and setter methods with validation checks (e.g., rejecting negative prices or empty strings).
- Default Constructors: Initialize objects with safe zero-value defaults.
- Parameterized Constructors: Allow instantiating fully populated objects cleanly in one call:
public Product(int id, String name, String category, double price, int quantity)
- The
Inventoryclass maintains a dynamicArrayList<Product>, demonstrating a "has-a" relationship where the inventory holds multiple independentProductinstances.
- Overrides the standard
Object.toString()method inProductto return meaningful debugging metadata.
- Entity data model (
Product.java), collection management logic (Inventory.java), and presentation/UI layer (Main.java) are separated into clean, modular classes.
| Java Concept | Implementation in Code |
|---|---|
| Java Collections Framework | Uses java.util.ArrayList and java.util.List to dynamically grow, filter, and iterate over product records. |
| Scanner & String Tokenization | Uses java.util.Scanner, nextLine(), trim(), and equalsIgnoreCase() for flexible CLI input. |
| Formatted Console Output | Employs System.out.printf with format specifiers (%-8d, %-22s, Rs. %.2f) for aligned tabular grids. |
| Exception Handling | Employs try-catch blocks catching NumberFormatException to ensure invalid numeric inputs never crash the runtime. |
| Static & Final Members | Uses static final modifiers for shared resources like Scanner and Inventory instances in Main. |
| String Algorithms | Uses String.toLowerCase() and String.contains() for case-insensitive partial searches. |
- Language: Java (JDK 17 / JDK 21 LTS compatible)
- Standard Library:
java.util.ArrayList,java.util.List,java.util.Scanner,java.util.InputMismatchException - Development Environment: Visual Studio Code / Terminal
- Version Control: Git & GitHub
Java-OOP-Inventory-Management-System/
│
├── src/
│ ├── Product.java # Entity class with encapsulated fields and methods
│ ├── Inventory.java # Collection management & inventory business logic
│ └── Main.java # Console UI, menu loop, and input validation
│
├── README.md # Comprehensive documentation
├── .gitignore # Excludes .class binaries, build folders, and IDE files
├── LICENSE # MIT License
│
└── screenshots/ # Output preview captures
├── main-menu.png
├── add-product.png
├── inventory-records.png
├── search-product.png
└── update-delete-product.png
| Operation | Method in Inventory.java |
Description |
|---|---|---|
| Create | addProduct(Product product) |
Validates ID uniqueness and appends new product to the collection. |
| Read | displayAllProducts(), searchById(), searchByName() |
Renders formatted tables and searches records by ID or name substring. |
| Update | updateProduct(id, name, category, price, qty) |
Modifies product fields while preserving existing values for blank inputs. |
| Delete | deleteProduct(int id) |
Locates and removes product from the ArrayList upon user confirmation. |
- In-Memory Storage: Product records are stored in memory using
java.util.ArrayList<Product>. - Pre-populated with realistic starter catalog items upon launch for immediate demonstration.
- Designed as an in-memory educational system demonstrating dynamic collection management and OOP manipulation.
- Java Development Kit (JDK 17 or higher) installed (
java -versionandjavac -version). - VS Code (with the Extension Pack for Java) or any command-line terminal.
git clone https://github.com/isrargabol/Java-OOP-Inventory-Management-System.git
cd Java-OOP-Inventory-Management-Systemjavac src/*.javajava -cp src Main(Alternatively, to compile into a separate bin directory:)
javac -d bin src/*.java
java -cp bin MainUpon launching the application, the interactive main menu is presented:
=============================================
JAVA INVENTORY MANAGEMENT SYSTEM
=============================================
1. Add New Product
2. View All Products
3. Search Product
4. Update Product Details
5. Delete Product
6. Low Stock Alerts
7. Inventory Summary Metrics
8. Exit
=============================================
Enter your choice:
| Option | Action |
|---|---|
1 |
Prompts for ID, Name, Category, Price, Quantity and adds a new product. |
2 |
Displays all inventory products in a tabular layout with summary totals. |
3 |
Searches for products by unique ID or by name keyword. |
4 |
Updates product details selectively with input validation. |
5 |
Deletes a product with Y/N confirmation. |
6 |
Displays dedicated reorder report for low/out-of-stock items. |
7 |
Shows grand totals for product count, stock count, and monetary valuation. |
8 |
Exits the application cleanly. |
========== ADD NEW PRODUCT ==========
Enter Product ID: 106
Enter Product Name: Web Camera 1080p
Enter Category: Video & Streaming
Enter Unit Price (Rs.): 6500.00
Enter Stock Quantity: 12
Product added successfully!
---------------------------------------------
Product ID : 106
Name : Web Camera 1080p
Category : Video & Streaming
Unit Price : Rs. 6500.00
Stock Qty : 12 units
Total Value : Rs. 78000.00
Stock Status : In Stock
---------------------------------------------
================================ ALL INVENTORY PRODUCTS ================================
ID Product Name Category Unit Price Quantity Total Value Status
--------------------------------------------------------------------------------------------------------
101 Mechanical Keyboard Peripherals Rs. 4500.00 15 Rs. 67500.00 In Stock
102 Gaming Mouse Peripherals Rs. 2200.00 24 Rs. 52800.00 In Stock
103 24-inch IPS Monitor Displays Rs. 28500.00 4 Rs. 114000.00 Low Stock
104 USB-C Hub 7-in-1 Accessories Rs. 3800.00 0 Rs. 0.00 Out of Stock
105 External SSD 1TB Storage Rs. 16500.00 8 Rs. 132000.00 In Stock
--------------------------------------------------------------------------------------------------------
Total Unique Products : 5
Total Physical Stock : 51 units
Total Inventory Value : Rs. 366300.00
- Console Interface (CLI): Does not feature a graphical UI (GUI) or web interface.
- In-Memory Storage: Data resets upon application termination (no external database server).
- Single-User Scope: Designed for single-session desktop execution.
- No Role Authentication: Accessible without multi-tier employee vs. manager permissions.
- Graphical User Interface (GUI): Implement a modern desktop interface using JavaFX or Swing.
- Database Integration: Connect to MySQL or PostgreSQL using JDBC / Hibernate.
- File / Database Persistence: Add JSON/CSV export and import capabilities.
- Authentication System: Add multi-role login (Admin, Manager, Cashier).
- Barcode & Supplier Tracking: Support barcode scanning and supplier purchase order workflows.
- REST API Backend: Migrate architecture to a Spring Boot microservice.
- Applying Object-Oriented Programming (OOP) principles in Java.
- Designing encapsulated domain models with defensive mutators.
- Utilizing the Java Collections Framework (
ArrayList) for dynamic data management. - Writing resilient console input routines with comprehensive error handling.
- Structuring a clean, professional Java repository ready for GitHub portfolios.
This project is licensed under the MIT License — feel free to use and adapt this code for educational and learning purposes.




