In this lesson, you'll learn how to create a companion object in your class, why you'd want them and how to use them in other classes.
Executing the same now prints, Object references like
[User@eed1f14, User@7229724f, User@4c873330, User@119d7047, User@776ec8df]
It is due to compiler version?
I'm using kotlin compiler version 1.4.10-release-IJ2020.2-1 on latest IntelliJ 2020.2.1
Code snippet: https://pl.kotl.in/F1Okh-DOB
Hello! Please look at the beginning of the video where I overrode the
toString() method. It looks like you do not have that overridden, which
is why you’re not seeing the correct output.
Thanks for you quick reply. It works as expected now. I wonder how this system override "toString" manipulates internally. Can you tell, a little more about it.
No problem. The default implementation is derived in the
superclass. The default implementation you were seeing is basically this
code that is in the Object superclass:
getClass().getName() + '@' +.
You can read more about it here: