Results 1 to 2 of 2
Thread: get output from vector
- 09-12-2008, 05:02 AM #1Member
- Join Date
- Sep 2008
- Rep Power
get output from vector
I have a class called student which includes 3 string variables: fName, lName, and gpa.
I have a vector called "s"
I read a text file into "s" using s.add(new Student(fname, lname, gpa))
The input goes fine, but when I do s.get(i), I am presented with student@memoryLocation.
How do I go about actually getting the s.Student(fname, lname, gpa)?
Thanks for your help!
you've got the Student object. The problem is that you are tr ying to print the Student object, and Student has not yet overridden the toString() method.
so, if you want to see student with:
If you want to check that you in fact have a student object, try calling one of its getter methods (I assume it has get and possibly set methods?).
- By jithan in forum Advanced JavaReplies: 1Last Post: 06-18-2008, 04:11 PM
- By king_arthur in forum New To JavaReplies: 3Last Post: 01-22-2008, 08:33 PM
- By mambo_jumbo in forum New To JavaReplies: 1Last Post: 11-17-2007, 11:44 PM
- By Java Tip in forum Java TipReplies: 0Last Post: 11-13-2007, 11:52 AM
- By Java Tip in forum Java TipReplies: 0Last Post: 11-04-2007, 06:58 PM