All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.
Moderators: Site Manager , fjwalraven
RobynBackhouse
Posts: 23 Joined: Sun Apr 14, 2013 10:37 am
Contact:
Post
by RobynBackhouse » Sat May 18, 2013 4:59 am
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?
admin
Site Admin
Posts: 10388 Joined: Fri Sep 10, 2010 9:26 pm
Contact:
Post
by admin » Mon May 20, 2013 5:34 pm
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.
Users browsing this forum: No registered users and 19 guests