You can use Statement.setFetchSize() to control the number of records fetched into memory when you iterate through result set. But in general I think it depends on JDBC driver on how it handles that setting and how it stores fetched records in memory.
EDIT: Here is an example (in theory result set will keep only 1 records in memory):
Statement stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.FETCH_FORWARD);
stmt.setFetchSize(1);
ResultSet srs = stmt.executeQuery("SELECT COF_NAME, PRICE FROM COFFEES");
while (srs.next()) {
String name = srs.getString("COF_NAME");
float price = srs.getFloat("PRICE");
// Do your processing...
}