更新查詢不返回結果。您需要在一條語句中進行更新,然後再選擇一條。另外,請使用參數化查詢 - 這樣的事情會更好
PreparedStatement stmt = connection.prepareStatement("UPDATE customer SET BALANCE = BALANCE + ? WHERE MOBILENUMBER = ?");
stmt.setDouble(1, amount);
stmt.setString(2, phone);
stmt.execute();
stmt.close();
stmt = connection.prepareStatement("SELECT BALANCE from customer where MOBILENUMBER = ?");
stmt.setString(1, phone);
ResultSet rs6 = stmt.execute();
rs6.next();
System.out.print("your account balance is " +rs6.getString("BALANCE"));
rs6.close();
stmt.close();
確保[小鮑比表(http://xkcd.com/327/)不設置,'phone'變量的值通過網絡應用:) – dasblinkenlight