Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-13-2008, 02:39 AM
Member
 
Join Date: Sep 2008
Posts: 15
pjr5043 is on a distinguished road
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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-13-2008, 02:47 AM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,223
Norm is on a distinguished road
Quote:
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.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 09-13-2008, 02:53 AM
Member
 
Join Date: Sep 2008
Posts: 15
pjr5043 is on a distinguished road
i ended up getting it. i needed to use strings from teh student file in the group file like member1.firstName
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Program littleBean New To Java 7 07-22-2008 01:07 AM
How to execute an External Program through Java program Java Tip java.io 0 04-04-2008 04:40 PM
New to Java Program jvasilj1 New To Java 1 02-05-2008 09:22 AM
How to execute an External Program through Java program JavaBean Java Tips 0 10-04-2007 11:33 PM
java program nehasahu New To Java 5 07-12-2007 01:05 PM


All times are GMT +3. The time now is 10:35 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org