Student Management System

The Student Management System is a console-based Java application designed to simulate a basic data management system used in schools and colleges. This project emphasizes the practical application of Object-Oriented Programming (OOP) concepts by enabling CRUD operations (Create, Read, Update, Delete) for student data. Each student is represented as an object with attributes like name, roll number, age, course, and marks. The system allows users to efficiently add new records, view all students, update existing records based on roll number, delete records, and perform quick searches by name or roll number. This project mimics real-world data entry systems and strengthens the developer’s understanding of data handling, object creation, class structure, and modular coding using Java.

The Student Management System (SMS) is a console-based Java application developed to handle and manage student-related data efficiently. It is designed to simulate how student information is maintained in educational institutions and focuses on implementing CRUD operations — Create, Read, Update, and Delete — through a simple menu-driven interface.

📌 Key Features:

  • Add Student: Users can input and save student details including Name, Roll Number, Age, Course, and Marks.

  • View Students: Displays all stored student records in a clean, structured format.

  • Update Student: Allows editing of student data by specifying their Roll Number.

  • Delete Student: Removes a student’s record permanently from the system.

  • Search Student: Enables quick lookup of student details using either Roll Number or Name.

🔧 Technologies & Concepts Used:

  • Object-Oriented Programming (OOP): The entire system is structured using OOP concepts like classes and objects to represent and manage student entities.

  • Encapsulation: Student attributes are kept private and accessed or modified through public getter and setter methods.

  • Collections (ArrayList): A dynamic list is used to store multiple student records in memory.

  • Scanner Class: Used for real-time input from users via the console.

  • Control Flow & Validation: Conditional checks ensure data consistency and provide appropriate feedback.

🎯 Learning Outcomes:

This project helps developers strengthen their understanding of:

  • Designing and implementing OOP-based solutions.

  • Handling user inputs and data validations.

  • Building interactive console applications.

  • Applying CRUD principles in real-world scenarios.

  • Managing dynamic collections of objects in Java.

🔄 Future Scope:

While the current version is limited to in-memory storage and basic functionalities, the system can be extended with:

  • File handling or Database integration (e.g., MySQL or SQLite) for data persistence.

  • Graphical User Interface (GUI) using Java Swing or JavaFX.

  • User roles and authentication (admin vs. student).

  • Reports and grading systems.

✅ Conclusion:

The Student Management System project effectively demonstrates how Java can be used to build practical applications. It serves as a strong foundation for enterprise-grade educational management systems and showcases the developer’s ability to translate core programming concepts into functional solutions. It is especially valuable for students and interns who are learning to develop real-world applications using Java.

Student_Management_System.java

import java.util.ArrayList;
import java.util.Scanner;

class Student {
    private String name;
    private int rollNumber;
    private int age;
    private String course;
    private int marks;

    public Student(String name, int rollNumber, int age, String course, int marks) {
        this.name = name;
        this.rollNumber = rollNumber;
        this.age = age;
        this.course = course;
        this.marks = marks;
    }

    // Getters and Setters
    public String getName() { return name; }
    public int getRollNumber() { return rollNumber; }
    public int getAge() { return age; }
    public String getCourse() { return course; }
    public int getMarks() { return marks; }

    public void setName(String name) { this.name = name; }
    public void setAge(int age) { this.age = age; }
    public void setCourse(String course) { this.course = course; }
    public void setMarks(int marks) { this.marks = marks; }

    public void displayInfo() {
        System.out.println(“Roll No: ” + rollNumber +
                           “, Name: ” + name +
                           “, Age: ” + age +
                           “, Course: ” + course +
                           “, Marks: ” + marks);
    }
}

public class StudentManagementSystem {
    private static ArrayList<Student> students = new ArrayList<>();
    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int choice;

        do {
            System.out.println(“\n📚 Student Management System 📚”);
            System.out.println(“1. Add Student”);
            System.out.println(“2. View All Students”);
            System.out.println(“3. Update Student”);
            System.out.println(“4. Delete Student”);
            System.out.println(“5. Search Student”);
            System.out.println(“0. Exit”);
            System.out.print(“Choose an option: “);
            choice = sc.nextInt();

            switch (choice) {
                case 1 -> addStudent();
                case 2 -> viewStudents();
                case 3 -> updateStudent();
                case 4 -> deleteStudent();
                case 5 -> searchStudent();
                case 0 -> System.out.println(“Exiting the system…”);
                default -> System.out.println(“Invalid choice. Please try again.”);
            }
        } while (choice != 0);
    }

    private static void addStudent() {
        System.out.print(“Enter Name: “);
        sc.nextLine(); // Consume newline
        String name = sc.nextLine();
        System.out.print(“Enter Roll Number: “);
        int rollNumber = sc.nextInt();
        System.out.print(“Enter Age: “);
        int age = sc.nextInt();
        sc.nextLine(); // Consume newline
        System.out.print(“Enter Course: “);
        String course = sc.nextLine();
        System.out.print(“Enter Marks: “);
        int marks = sc.nextInt();

        students.add(new Student(name, rollNumber, age, course, marks));
        System.out.println(“✅ Student added successfully!”);
    }

    private static void viewStudents() {
        if (students.isEmpty()) {
            System.out.println(“❌ No students found.”);
            return;
        }
        System.out.println(“\n📋 List of Students:”);
        for (Student s : students) {
            s.displayInfo();
        }
    }

    private static void updateStudent() {
        System.out.print(“Enter Roll Number of student to update: “);
        int rollNumber = sc.nextInt();

        for (Student s : students) {
            if (s.getRollNumber() == rollNumber) {
                sc.nextLine(); // Consume newline
                System.out.print(“Enter New Name: “);
                s.setName(sc.nextLine());
                System.out.print(“Enter New Age: “);
                s.setAge(sc.nextInt());
                sc.nextLine(); // Consume newline
                System.out.print(“Enter New Course: “);
                s.setCourse(sc.nextLine());
                System.out.print(“Enter New Marks: “);
                s.setMarks(sc.nextInt());

                System.out.println(“✅ Student updated successfully!”);
                return;
            }
        }
        System.out.println(“❌ Student not found.”);
    }

    private static void deleteStudent() {
        System.out.print(“Enter Roll Number of student to delete: “);
        int rollNumber = sc.nextInt();

        for (Student s : students) {
            if (s.getRollNumber() == rollNumber) {
                students.remove(s);
                System.out.println(“🗑️ Student deleted successfully!”);
                return;
            }
        }
        System.out.println(“❌ Student not found.”);
    }

    private static void searchStudent() {
        sc.nextLine(); // Consume newline
        System.out.print(“Search by (1: Roll Number, 2: Name): “);
        int opt = sc.nextInt();

        if (opt == 1) {
            System.out.print(“Enter Roll Number: “);
            int roll = sc.nextInt();
            for (Student s : students) {
                if (s.getRollNumber() == roll) {
                    s.displayInfo();
                    return;
                }
            }
        } else if (opt == 2) {
            sc.nextLine(); // Consume newline
            System.out.print(“Enter Name: “);
            String name = sc.nextLine();
            for (Student s : students) {
                if (s.getName().equalsIgnoreCase(name)) {
                    s.displayInfo();
                    return;
                }
            }
        }
        System.out.println(“❌ Student not found.”);
    }
}
Scroll to Top