package com.tool;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import com.bean.Teacher;
import com.bean.TeacherDAO;
public class SchoolManager {
public static TeacherDAO tbao = new TeacherDAO();
private static List<Teacher> allTeacher;
static {
Timer t = new Timer();
t.schedule(new TimerTask(){
@Override
public void run() {
SchoolManager.setAllTeacher();
}
}, new Date(), 1000 * 60);
}
public static void setAllTeacher() {
allTeacher = SchoolManager.tbao.findAll();
System.out.println(allTeacher.get(0).getTname()+"================================");
}
public static List<Teacher> findAllTeacher() {
return allTeacher;
}
}
问 调用findAllTeacher()方法时 allTeacher的值用的是哪个??别的都不看只问它的执行顺序。 |
|