Results 1 to 3 of 3
Thread: Problem with String Building
- 07-09-2007, 08:20 PM #1
Senior Member
- Join Date
- Jun 2007
- Posts
- 114
- Rep Power
- 0
Problem with String Building
I'm having trouble building strings while implementing a BST. For whatever reason which i cant figure out the stings are being printed in what i believe is hashcode. How can i get the string to print the "real string".
My code basically looks like this
Java Code:String bob = ""; String bob += inOrderTrav(n.left);
What am i missing here? Why is the string showing up as hashcode at System.out?
Thanks
Albert:rolleyes:
- 04-29-2012, 11:56 PM #2
Umang Bhatt
- Join Date
- Apr 2012
- Location
- Nadiad, Gujarat, India.
- Posts
- 3
- Rep Power
- 0
Re: Problem with String Building
probably you need to write the toString() method,
please post more code.
- 04-30-2012, 01:49 AM #3
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,068
- Blog Entries
- 3
- Rep Power
- 15
Re: Problem with String Building
Default toString method inherited from the Object class prints some sort of identifier followed by the hexadecimal representation of the objects hashcode. Try overriding toString().
Gah, very old post. Bhatt.umang7, please don't bump threads that are nearly 5 years old.
Similar Threads
-
help needed regarding tree building
By invincible_me in forum New To JavaReplies: 2Last Post: 08-12-2008, 02:44 PM -
String and Arry Problem
By farakhkhan@yahoo.com in forum New To JavaReplies: 3Last Post: 03-31-2008, 11:17 AM -
building a house
By dc2acgsr99 in forum Java AppletsReplies: 4Last Post: 03-08-2008, 12:18 AM -
Building a document from a DOM
By Java Tip in forum Java TipReplies: 0Last Post: 01-03-2008, 10:22 AM -
problem with using string in if condition
By sireesha in forum New To JavaReplies: 2Last Post: 11-20-2007, 11:40 PM
Bookmarks