Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7399901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:07:17+00:00 2026-05-29T04:07:17+00:00

Suppose I have a table MYtable as given below: ID A B C 1

  • 0

Suppose I have a table MYtable as given below:

ID   A     B        C
1   100  APPLE     CAKE
2   200  BANANA    PIE

I want to be able to save all these table records into a list (of some kind) and iterate through each record.

Query would be :

select * from Mytable where ID in (1,2,3)

So,the list should have 2 records:
record1 should contain 1,100,APPLE,CAKE
and record2 should contain 2,200,BANANA,PIE

I also want to be able to iterate through each record

So for record1 – I want to getColumnA i.e 100, getColumnB i.e APPLE, and so on

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T04:07:18+00:00Added an answer on May 29, 2026 at 4:07 am
    List<YourObject> listOfObjects = new ArrayList<YourObject>();
      while(rs.next()){
            int id = rs.getInt(1);
            int A = rs.getInt(2);
            String B= rs.getString(3);
            String C = rs.getString(4);
            YourObject ob = new YourObject (id, A, B, C);
            listOfObjects.add(ob); //now you have the list of objects .. iterate trough it
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have table Person table Employee, which inherits Person. I want to get
Suppose I have a MySQL table called MyTable, that looks like this: +----+------+-------+ |
Suppose I have a table called device as below: device_id(field) 123asf15fas 456g4fd45ww 7861fassd45 I
suppose I have this table var 10 3 4 60 70 and I want
Suppose that we have, in mysql , a table mytable with the columns: id,
Suppose that I have a table my_table(id, x, y) . I want to write
Suppose I have a table view, and I want to implement something like this:
Suppose I have table A with a field that can be either 1 or
Suppose we have a table A: itemid mark 1 5 2 3 and table
Suppose I have a table called Companies that has a DepartmentID column. There's also

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.