我写了一个定时触发类
    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对象。何解?

解决方案 »

  1.   

    java.lang.NullPointerException 
    检查a方法中的对象是否都已经赋值
      

  2.   

    貌似 if ("14:33".equals(time)) 这个地方不对 .DEBUG跟踪一下吧
      

  3.   

      问下大家 我有个 str = "1000>100" 我要做个用这个表达式得到true and false
     要怎样做不知道我表达清楚没 也就是
        if (str)
       {
          do()
        }
     现在 str 是String 类型