我對Java很新,無法理解try/catch在下面的代碼中需要去的地方。這個項目還有很多,但這是問題區域在java代碼中插入try/catch的位置
Statement stmt = con.createStatement();
String query = "SELECT FirstName, LastName FROM Customer";
ResultSet rs = stmt.executeQuery(query);
while (rs.next())
{
String ln = rs.getString("FirstName");
String ln1 = rs.getString("LastName");
System.out.println(ln + " " + ln1);
}
https://docs.oracle.com/javase/tutorial/jdbc/basics/可能是值得一讀 –