The id
is the default way for Eclipse to help you distinguish objects. It's a number assigned by Eclipse itself the first time it had to present that particular object to you, and if it later shows you the same object again, it will have the same id. It's purely for debugging, and exactly allows you to see whether two references are to the same object or to different objects, even if both have a toString
returning just Instance of "StateManager"
.
So to answer the two remaining questions: You use the id
to see if objects are identical, and you don't need to override toString
.
See also: What is the id=xxx next to variable entries in the Eclipse Debugger