如何得到c和今天在fetchingData()中不可見? 在main-class中運行代碼時,我得到一個NullPointer異常:/ 感謝您的幫助!NullPointerException構造函數
public class InputData {
Calendar c;
Date today;
String DATE_FORMAT = "MM/dd/yyyy";
SimpleDateFormat sdf;
Double[][] hPrice;
Double[][] qhPrice;
Double[][] qhEua;
Double[][] qhGas;
Integer[][] qhTemperature;
Integer[][] qhAirpressure;
Date[][] qhDate; // may be useful some day
Date[][] qhWeatherDate; // may be useful some day
public InputData() {
Calendar c = Calendar.getInstance();
Date today = new Date();
today = c.getTime();
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
System.out.println(sdf.format(today));
}
public void startFetching() {
// +++ Access-Import EUA's +++
Access aQuery = new Access();
c.add(Calendar.DATE, -1);
today = c.getTime();
aQuery.eua(sdf.format(today));
其中是fetchingData()方法? –
'fetchingData()'在哪裏?你的'main()'看起來像什麼?你怎麼知道它是引發Exception的''''?什麼是堆棧跟蹤? – QBrute
對不起其實其startFetching() - 方法 – Andrew