创建测试类TestTeacherDao:
public class TestTeacherDao {
public static void main(String[] args) {
TeacherDao dao = new TeacherDao();
// 调用getTeacherByTnum()
Teacher teacher = dao.getTeacherByTnum("T001");
System.out.println(teacher);
// 调用getAllTeachers()
List<Teacher> teachers = dao.getAllTeachers();
for (Teacher t : teachers) {
System.out.println(t);
}
// 调用insertTeacher()
Teacher newTeacher = new Teacher("T002", "张三", "男", "教授");
dao.insertTeacher(newTeacher);
}
}
注意: 这只是一个示例代码,实际的实现可能会有不同.