Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2008
    Rep Power

    Default get output from vector

    Hello all,

    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!

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    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:
    Java Code:
    then Student needs a toString override.

    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?).

Similar Threads

  1. sort a vector
    By jithan in forum Advanced Java
    Replies: 1
    Last Post: 06-18-2008, 03:11 PM
  2. Vector help
    By king_arthur in forum New To Java
    Replies: 3
    Last Post: 01-22-2008, 07:33 PM
  3. vector problem
    By mambo_jumbo in forum New To Java
    Replies: 1
    Last Post: 11-17-2007, 10:44 PM
  4. using Iterator with Vector
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-13-2007, 10:52 AM
  5. Vector capacity
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-04-2007, 05:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts