1

While debugging in Intellij IDEA, I can see objects with {TYPE@SOME_NUMBER}, e.g. as can be seen in the picture below {PersistentBag@8507}.

What is SOME_NUMBER, e.g. 8507? How does Intellij calculates it?

Intellij IDEA debugger

Patrik Mihalčin
  • 3,341
  • 7
  • 33
  • 68

1 Answers1

1

That's basically just a memory reference. In general, you'll never need to do anything with it and can just ignore it.

I've never actually seen a scenario where you actually need to care about that number. Since Java manages memory for you, it won't really ever matter.

About the only thing I can think of that would matter would be you can use that number to determine if a value in two places is the same value, or just look the same.

For example, if you pass an object as a value to do different classes, they would both show the same @SOME_NUMBER, meaning they're the same object.

samanime
  • 25,408
  • 15
  • 90
  • 139