-3

i am really a bit clueless.I use JAXB for reading values out of xml files,and also SAX parser,where the same problem occurs.It seems to be code-independent,but i am really with no idea. While trying to read attributes out of XML files,and i also copied several code examples out of the net---i want them to be shown after serializing them and also before. Likle for example i have a xml File with book elements in it.And printing them out. Instead of the expected values like : author=xxx , price =yyy etc i just get an output like:

packagename.Book@1fbc355 packename.Book@1d532ae when i want to let me show the values.

This Problem i not only have with the complete copied examples ,but also with my own code,so it must be a code-independent problem,but i have no clue what it could be. So i get no output in Form of parsing results ,but just this kind of stuff. I have really no idea.Perhaps somebody has an idea what i am generally doing wrong.I would be very thankful(serveral days of trying with no result)

1 Answers1

1

Java calls the .toString() method of an object when printing an object that isn't a string. The base Object class by default implements .toString() as returning a string with class name and the hexadecimal representation of the hashCode() of the object. So if you want the object to be printed differently, you'll need to implement a custom .toString() method

Lie Ryan
  • 62,238
  • 13
  • 100
  • 144