About Question enthuware.ocpjp.v7.2.1198 :
Posted: Sat May 18, 2013 4:59 am
Option 4 :
Surely this one won't even compile, as ResultSet rs is declared twice?
No mention is made of this in the explanation though?
Code: Select all
Statement stmt = null;
ResultSet rs = null;
try{
stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("select * from STUDENT");
while(rs.next()){
//do something with the row
}
}
finally{
rs.close(); stmt.close();
}
No mention is made of this in the explanation though?