Meaningless Drivel is fun!
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
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
It's not a secret anymore!