0% found this document useful (0 votes)
12 views2 pages

Java OOPs Mini Project Student Management

Java oops based mini project

Uploaded by

511 Akshitha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

Java OOPs Mini Project Student Management

Java oops based mini project

Uploaded by

511 Akshitha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Mini Project: Student Management System in Java (OOPs Concepts)

Objective:

To create a basic student management system that:

- Stores student details (name, age, ID, course)

- Displays details of each student

- Uses all four OOPs pillars: Encapsulation, Inheritance, Polymorphism, and Abstraction

Encapsulation:

Encapsulation is achieved by making class variables private and providing public getter and setter

methods to access and update them.

Inheritance:

Inheritance allows one class to inherit the properties and methods of another. In this project, Student

inherits from Person.

Polymorphism:

Polymorphism allows one interface to be used for a general class of actions. Here, method

overriding is used to define displayDetails differently in Student.

Abstraction:

Abstraction hides implementation details and shows only functionality. The interface Displayable

abstracts the displayDetails method.

Displayable Interface (Abstraction)


interface Displayable {
void displayDetails();
}

Person Class (Encapsulation)


class Person {
private String name;
private int age;

public Person(String name, int age) {


this.name = name;
this.age = age;
}

public String getName() {


return name;
}

public int getAge() {


return age;
}
}

Student Class (Inheritance + Polymorphism)


class Student extends Person implements Displayable {
private String studentId;
private String course;

public Student(String name, int age, String studentId, String course) {


super(name, age);
this.studentId = studentId;
this.course = course;
}

public void displayDetails() {


System.out.println("----- Student Details -----");
System.out.println("Name : " + getName());
System.out.println("Age : " + getAge());
System.out.println("ID : " + studentId);
System.out.println("Course : " + course);
System.out.println("----------------------------");
}
}

Main Class (Bringing It Together)


public class StudentManagementSystem {
public static void main(String[] args) {
Student s1 = new Student("Ananya", 21, "S101", "Java OOPs");
Student s2 = new Student("Ravi", 22, "S102", "DBMS");

s1.displayDetails();
s2.displayDetails();
}
}

Final Summary Table:

Encapsulation: Private variables + getters in Person class.

Inheritance: Student extends Person class.

Polymorphism: Overridden displayDetails() method in Student class.

Abstraction: Interface Displayable with abstract method.

You might also like