我在这里有一个简单的程序:
public class Main {
private static Connection connectON = null;
private static PreparedStatement preparedStatementON = null;
public static void main (String args[]) throws Exception {
try{
Class.forName("org.mariadb.jdbc.Driver");
connectON = DriverManager.getConnection("jdbc:mysql:/234234/ /?"+"user t& d= 3");
System.out.println("Trying to connect to online"+connectON);
System.out.println( "-----MAIN----");
BaseDataUploader da = new BaseDataUploader();da.readDataB ();
}
catch (Exception e) {
BaseDataUploader da2 = new BaseDataUploader(); //loads data from DFA to base
da2.errorLog(e,0000);
throw e;
}
finally {
if(preparedStatementON !=null)
preparedStatementON.close();
if(connectON !=null)
connectON.close();
}
}
}
现在我想知道即使没有发生异常,是否在catch语句中创建了新对象?多谢你们。