Owen Martin wrote:But when I try and return I get this error code
Nameofpackage.Tree@e48e1b
That's not an error, that's the default return value for toString(). It is the full class name with package as you've already figured out, followed by an @ and the hash code in hexadecimal format.
If you override toString() you can make it print out whatever you want:
Of course this is not a good implementation, but you can basically return whatever you want. Usually you return something that is built using one or more of the fields. The data would seem a good candidate.