這裏顯示空行指針異常在行;如何解決使用數組時空指針異常?
String[] count = null;
String[] arr = null;
int i = 0;
rs2 = st2.executeQuery("SELECT COUNT(*) as y FROM " + usrtbl + " WHERE user_id NOT IN (SELECT user_id FROM " + usrroletbl + ")");
rs2.next();
if (rs2.getInt("y") == 0) {
arr[i] = "false";
count = arr;
i++;
} else {
arr[i] = "true";
count = arr;
i++;
}
任何幫助將不勝感激。
你怎麼能訪問'ARR [0]'轉換成ArrayList的數組?當你聲明'String [] arr = null;'時 – ravi