Page 1 of 1

About Question enthuware.ocpjp.v7.2.1198 :

Posted: Sat May 18, 2013 4:59 am
by RobynBackhouse
Option 4 :

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(); 
}
Surely this one won't even compile, as ResultSet rs is declared twice?
No mention is made of this in the explanation though?

Re: About Question enthuware.ocpjp.v7.2.1198 :

Posted: Mon May 20, 2013 5:34 pm
by admin
You are right. Although it is an incorrect option anyway, the second ResultSet should not be there. This has now been fixed.

thank you for your feedback!
Paul.