changing `.toString()` in subclasses without overwriting everything
thats the output i get:
and the output i want to get is:
My Question
Is there a way to just change a part of the
.toString() method without @Overrideing it entirely.
one bothersome solution i thought of is creating a formater taking a String (String type = "Person") created by the constructor. but still itd be botherring.5 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.
you can use
getClass().getName()/getClass().getSimpleName()
thanks, i currently did it with
String[] type = getClass().toString().split("[.]"); and
type[1]
but getClass().getSimpleName() is definetly better xdIf 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>.