This week's book giveaways are in the iOS and Features new in Java 8 forums.
We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes arraylist of objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "arraylist of objects" Watch "arraylist of objects" New topic

arraylist of objects

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
(edit- use arraylist instead of vector)

The constructor of the panel class should initialize all instance variables including the Vector object. To simulate data in a file, you can create a vector of Student objects. To do this, create three Student objects based on the following information:
John Jones 88 92 95
Kelly Green 76 83 86
Jeff Smith 92 94 88
Then, add each of these objects to the Vector object.


something like this?

public class panel
public string name;
public int scores;

public panel(string inName, int inScores)
name = inName;
scores = inScores;
panel student1 = new panel("John Jones", "88 92 95");
panel student3 = new panel("Jeff Smith", "92 94 88");


[ July 17, 2004: Message edited by: Giles Harney ]
I agree. Here's the link:
subject: arraylist of objects