The Library Management System is a simple menu-driven console application built using Java Object-Oriented Programming (OOP) concepts. It allows users to add, remove, borrow, return, and display books in a library. The project demonstrates Encapsulation, Inheritance, Abstraction, and Polymorphism in a real-world example.
-
β Add a Book β Add new books with Title, Author, and ISBN.
-
β Remove a Book β Remove books from the library using ISBN.
-
π Borrow a Book β Borrow books if available.
-
π Return a Book β Return borrowed books to the library.
-
π Display All Books β View all books with their availability status.
-
πͺ Exit System β Exit cleanly with a goodbye message.
- Encapsulation β
-
Book details (title, author, ISBN, availability) are private with getters/setters.
-
User details (name, ID) are encapsulated.
-
- Inheritance β
- Student and Librarian classes inherit from abstract User class.
- Abstraction β
- Abstract class User defines displayInfo() method which is overridden.
- Polymorphism β
-
Compile-time: Method overloading (setters, constructors).
-
Runtime: Method overriding (displayInfo() in Student & Librarian).
-
LibraryManagementSystem/
β
βββ Book.java # Book entity (Encapsulation)
βββ User.java # Abstract User class (Abstraction)
βββ Student.java # Student extends User (Inheritance + Polymorphism)
βββ Librarian.java # Librarian extends User (Inheritance + Polymorphism)
βββ Library.java # Manages list of books
βββ Main.java # Runs the menu-driven program
Using IntelliJ IDEA / Eclipse
-
Open your IDE and create a Java Project.
-
Copy all the .java files into the src folder.
-
Set Main.java as the main class (contains public static void main).
-
Run the project β The Library Management System menu will appear in the console.
Library Management System Menu:
1. Add Book
2. Remove Book
3. Borrow Book
4. Return Book
5. Display All Books
0. Exit
Enter your choice: 1
Enter Title: Java Basics
Enter Author: James Gosling
Enter ISBN: 101
β
Book added successfully!
Lohar Sumermal
Java Developer | Backend Enthusiast