wrong output with toString()
Output:
Why is
[Magier@eed1f14, Krieger@7229724f, CharakterKlasse@4c873330]
not displayed as [Magier 'Gandalf', Krieger 'Aragorn', Charakter 'Bilbo']?18 Replies
⌛ This post has been reserved for your question.
Hey @Darknesslion5|Christian! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
Did you override the
toString() method in your character classes?wait ill send it in
as far as i know i didnt
Then that is the reason.
If you don't provide any override it will just print as
classname@hexhash.how would you overwrite it
i havent used
@Overwrite for anything but a method in a subclass
btw. thank you for the answerIf you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
poah
Oh, no name getter. Let me fix.
thank you for the solution
but honestly, i think i wouldnt be able to recreat it
Well this solution automatically uses the name of the class.
if i want toString() being the level instead. i could replace
this.name with this.level right?Yes. Put there whatever you want to have printed out.
and why did u do
`" \"" and "\""To resemble
Magier "Gandalf"alright thank you
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Post Closed
This post has been closed by <@245536392308981760>.