可以啊.自己用代码验证吧.
public void method(){
Connection conn = null;
try{
//注意这是不规范的语法
try {
conn = DriverManager.getConnection("");
} catch (SQLException e) {
e.printStackTrace();
}
}catch (Exception e) {
e.printStackTrace();
}
//以上方式最好这样
try{
conn = DriverManager.getConnection("");
} catch (SQLException e) {
e.printStackTrace();
}catch (Exception e) {
e.printStackTrace();
}
Statement state= null;
try {
state = conn.createStatement();
} catch (SQLException e) {
e.printStackTrace();
}
}