Say I have an list of objects with two fields field1 and field2, both of String type.
How do I get a list of all field1 values wit
Add the values of records in different lists and by using the one or two iterator simply print the seperate values.like follows:
rs=st.executeQuery("select * from stu");
List data=new ArrayList();
List data1=new ArrayList();
while(rs.next())
{
data.add(rs.getString(1));
data1.add(rs.getString(2));
}
Iterator it=data.iterator();
Iterator it1=data1.iterator();
while(it1.hasNext())
{
System.out.println(" "+it.next()+" "+it1.next());
}