When I debug java app in Intellij Idea I see all variables in a stack frame like this:
object={java.lang.Object@77}
What does the number after "@" mean? It is different from what hashCode returns. hashCode returns number 2a134eca in hex representation which equals to 705908426 in integer representation. Numbers 77 and 705908426 are distinct.
解决方案
The @ is the object count number since the app started. So @1012 means the 1012th object created since the app started.
It is not the identity hashcode.
Here is some proof: (I say this because I don't actually know, but I observed it)
public static void main(String [] args) throws Throwable {
Object object = new Object();
Object object1 = new Object();
Integer foo = new Integer(5);
Object object2 = new Object();
String str = new String("bar");
System.out.println("code :" + System.identityHashCode(object));
RuntimeException exception = new RuntimeException();
exception.printStackTrace(); //put breakpoint here
}
Output:
code :789451787
code :java.lang.Object@2f0e140b
789451787=2f0e140b By the way...
Output from IntelliJ Debugger:
static = org.boon.core.MyClass
args = {java.lang.String[0]@**97**}
object = {java.lang.Object@**98**}
object1 = {java.lang.Object@**99**}
foo = {java.lang.Integer@**100**}"5"
object2 = {java.lang.Object@**101**}
str = {java.lang.String@**102**}"bar"
exception = {java.lang.RuntimeException@**103**}"java.lang.RuntimeException"
I know this empirically, but I don't know the actual implementation, but I think it is related to issues like this: