One more, Techguy

Archived from the original Sajha.com — preserved as posted, replies can no longer be added here.
Start a New Discussion
Archived Post

So in the program u helped me with, u wanted me to create a list of 20 names using loops? I can use array and then use a loop to store 20 names, but how to i create multiple object using a loop, like S1, S2 and so on? Dorje

zeePa · May 10, 2009 8:45 AM · 2,907 views

1 Reply

        Student s[] = new Student[20];         LinkedList l = new LinkedList();         for(int i=0;i<20;i++)         {             //fname = get firsname from user             //lname =  get lastname from user             //for eg. i'm hard coding the values             //This will store AAA and BBB for all 20 objects             //if you take it from user it will be diff.             s[i]= new Student("AAA","BBB");             l.add(s[i]);         }

techGuy · May 10, 2009 12:42 PM

This conversation is preserved exactly as it was on the original Sajha.com and can't accept new replies.

Start a New Discussion

You might be interested in...

Recent Classifieds View all
Upcoming Events View all
Service Providers View all