在下面这段代码中,你能够迅速找出异常处理的六个问题吗?
1 OutputStreamWriter out = …
2 java.sql.Connection conn = …
3 try { // ⑸
4 Statement stat = conn.createStatement();
5 ResultSet rs = stat.executeQuery(
6 ”select uid, name from user”);
7 while (rs.next())
8 {
9 out.println(“ID:” + rs.getString(“uid”) // ⑹
10 ”,姓名:” + rs.getString(“name”));
11 }
12 conn.close(); // ⑶
13 out.close();
14 }
15 catch(Exception ex) // ⑵
16 {
17 ex.printStackTrace(); //⑴,⑷
18 }
|