i use while(rs.next()) to get data from a table named "xx" in oracle,
code is :
int j=0;
while (rs.next())
{
j=rs.getint(1)+1;
System.out.println(rs.getint(1))
}
someone told me that if there are no record in table "xx",rs.next() return false,so j should equals 0 and System.out.println should not execute
but i find that even there are no record in table "1", j equals 1! and print 0 in
tomcat's console
why?i believe if rs.next() return false,j=rs.getint(1)+1 and System.out.println should not execute,but infact it execute.
is anybody can help me? thanks a lot