Results 1 to 3 of 3
  1. #1
    pjr5043 is offline Member
    Join Date
    Sep 2008
    Posts
    16
    Rep Power
    0

    Default need help with java program

    i have to create a program that will output informatin of a group. the group will have a groupname and studnets in the group. right now i have a student file, a group file, and the app file. my professor was telling me i was doing evenrything right, and it sort of is working, but the problem is this:

    student names are inputed in the app file, then i take them from the app file and pt them into the group file to create a group. but when i output the code in the app, i get the right name for the group, but for my studnets i get like an address like this "student@12dacd1". i'm not sure how to fix this. so any help is appreciated

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,816
    Rep Power
    25

    Default

    i get like an address like this "student@12dacd1".
    What you are seeing is the default value returned by the Object class's toString() method. You must be trying to use println on a class object which you have not overriden the toString method.
    Add a toString() method to your class to return what you want to see. Read the API doc for the Object class's toString method so you code it correctly when you override it. If you are using Java 1.6 (maybe also 1.5) add @Override before the definition of the method to have the compiler check that you have correctly coded the override.

  3. #3
    pjr5043 is offline Member
    Join Date
    Sep 2008
    Posts
    16
    Rep Power
    0

    Default

    i ended up getting it. i needed to use strings from teh student file in the group file like member1.firstName

Similar Threads

  1. Java Program
    By littleBean in forum New To Java
    Replies: 7
    Last Post: 07-22-2008, 12:07 AM
  2. Replies: 0
    Last Post: 04-04-2008, 03:40 PM
  3. New to Java Program
    By jvasilj1 in forum New To Java
    Replies: 1
    Last Post: 02-05-2008, 08:22 AM
  4. Replies: 0
    Last Post: 10-04-2007, 10:33 PM
  5. java program
    By nehasahu in forum New To Java
    Replies: 5
    Last Post: 07-12-2007, 12:05 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
  •