student.java
package geyao.item.data; public class Student { private String id; private String name; private int age; private String address; public Student() { } public Student(String id, String name, int age, String address) { this.id = id; this.name = name; this.age = age; this.address = address; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } }
StudentSystem.java
package geyao.item.data; import java.util.Scanner; public class StudentSystem { public static void main(String[] args) { loop:while (true){ System.out.println("---欢迎来到学生管理系统-----"); System.out.println("1:添加学生"); System.out.println("2:删除学生"); System.out.println("3:修改学生"); System.out.println("4:查询学生"); System.out.println("5:退出学生"); System.out.println("请输入你的选择"); Scanner sc=new Scanner(System.in); String choose=sc.next(); switch (choose){ case "1"-> System.out.println(":添加学生"); case "2"-> System.out.println(":删除学生"); case "3"-> System.out.println(":修改学生"); case "4"-> System.out.println(":查询学生"); case "5"-> { System.out.println(":退出"); //跳出当前循环 break loop; } default-> System.out.println("没有这个选项"); } } } }