public class StuTest {
public static void main(String[] args) {
while (true) {
System.out.println("欢迎进入教务在线");
System.out.println("登录请按1");
System.out.println("注册请按2");
System.out.println("退出请按3");
Scanner sc = new Scanner(System.in);
String line = sc.nextLine();
switch (line) {
case "1":
System.out.println("请输入帐号");
String name = sc.nextLine();
System.out.println("请输入学号");
String id = sc.nextLine();
// 创建对象进行比较
StuDaoImpl sdi = new StuDaoImpl();
if (sdi.login(name, id)) {
System.out.println("登陆成功");
System.exit(0);
break;
} else {
System.out.println("登录失败,请重试");
break;
}
case "2":
System.out.println("欢迎注册");
System.out.println("请输入帐号");
String newName = sc.nextLine();
System.out.println("请输入学号");
String newId = sc.nextLine();
System.out.println("请输入年龄");
String newAge = sc.nextLine();
Student stu = new Student();
stu.setName(newName);
stu.setId(newId);
stu.setAge(newAge);