我写了一个定时触发类
public class ManageSendInform extends TimerTask{
@Override
public void run() {
// TODO Auto-generated method stub
Calendar now=Calendar.getInstance();
String time=now.get(Calendar.HOUR_OF_DAY)+":"+now.get(Calendar.MINUTE);
System.out.println("time="+time);
if ("14:33".equals(time))
{
try {
this.a();
} catch (Tw_Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} 如果每天到14:33的时候就触发a方法 但是不知道为什么报Exception in thread "Timer-0" java.lang.NullPointerException
在a方法下有个很普通的查询SQL语句 得到一个DATATABLE对象。何解?
public class ManageSendInform extends TimerTask{
@Override
public void run() {
// TODO Auto-generated method stub
Calendar now=Calendar.getInstance();
String time=now.get(Calendar.HOUR_OF_DAY)+":"+now.get(Calendar.MINUTE);
System.out.println("time="+time);
if ("14:33".equals(time))
{
try {
this.a();
} catch (Tw_Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} 如果每天到14:33的时候就触发a方法 但是不知道为什么报Exception in thread "Timer-0" java.lang.NullPointerException
在a方法下有个很普通的查询SQL语句 得到一个DATATABLE对象。何解?
检查a方法中的对象是否都已经赋值
要怎样做不知道我表达清楚没 也就是
if (str)
{
do()
}
现在 str 是String 类型