ResultSet is a interface
More gnerally,ResultSet is a class involves a table returned by executeQuery cluase from jdbc,which includes the whole information we wanna get from our query,however if we want to retrive these info in java applet ,jdbc provides us a cursor.Let's see how Java API explain it
After reading this explanation , we can understand the meaning of whlie (rs.next()) {...}
![](https://images2015.cnblogs.com/blog/830677/201604/830677-20160410205127265-1230225970.jpg)
In the while loop,we use cursor to access each row,but here comes the problem:how could we convert the underlying data in the set pointed by cursor to Java type?Here are the explanation from Java API:
![](https://images2015.cnblogs.com/blog/830677/201604/830677-20160410205134984-502028199.jpg)
We must provide a parameter to getter methods we invoke,which stands for the column that we wanna get information from.As for the parameter,API also give us some details about it.Let's take a look at it:
![](https://images2015.cnblogs.com/blog/830677/201604/830677-20160410205202781-418989001.jpg)
The last thing I think that our attention should be paid to is that the lifecycle of the ResultSet
![](https://images2015.cnblogs.com/blog/830677/201604/830677-20160410205140781-1159660384.jpg)