public void run() {
//执行任务(sql)
System.out.println("do Task...");
}
public void end(){
myTimer.cancel();
//终止Timer的功能执行,但不会对正在执行的任务有影响。当执行cancel方法后将不能再用其分配任务。
}
//测试
public static void main(String args[]) {
doTask myTask1 = new doTask();
//Get the Date corresponding to 11:30:00 pm today.
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 30);
calendar.set(Calendar.SECOND, 0);
Date time = calendar.getTime();