Behaviour of ResultSet

On reaching statement 2 in:
Statement 1;
resultset = prepstmt.executeQuery();
Statement 2;
,can we assume that all the required data has been fetched ?
I mean to ask that when we reach the statement: while(resultset.next()) ,is it the case that all the data has been fetched and filled in the resultset or the resultset keeps on getting updated when the while loop is running ?

No you can't assume that all the required data has been fetched . You can't think of a ResultSet as a container that holds your data.
After you execute your query, the ResultSet serves as a gateway to retrieve that resultsfrom the database.
That is what you do with while (ResultSet.next()):
You loop over the rows returned by the SQL statement, and the ResultSet serves these rows one by one.

The resultset is not updated during the while (next()) loop, but the record pointer is moved to the next row.

(note and disclaimer: simplified explanation. We don't know how a JDBC driver actualy fulfills this functionality)

No you can't assume that all the required data has been fetched . You can't think of a ResultSet as a container that holds your data.
After you execute your query, the ResultSet serves as a gateway to retrieve that resultsfrom the database.