Untitled

mail@pastecode.io avatar
unknown
java
a year ago
619 B
1
Indexable
Never
public class MgmtAppTask {
    public static void main(String[] args) {
        StudentDatabase database = new StudentDatabase();

        // Demonstrate adding, updating, and listing students
        Student student1 = new Student("Alice", 20, "Computer Science");
        Student student2 = new Student("Bob", 21, "Engineering");
        database.addStudent(student1);
        database.addStudent(student2);

        Student retrievedStudent = database.getStudent(1);
        retrievedStudent.setName("Alex");
        database.updateStudent(retrievedStudent);

        database.listStudents();
    }
}