Output of System.out.println(object)

Posted by Shaarad Dalvi on Stack Overflow See other posts from Stack Overflow or by Shaarad Dalvi
Published on 2012-11-21T16:54:18Z Indexed on 2012/11/21 16:59 UTC
Read the original article Hit count: 195

Filed under:
|

I want to know what exactly the output tells when I do the following :

class data {
    int a=5;
}
class main {
    public static void main(String[] args) {
         data dObj=new data();
         System.out.println(dObj);
    }
}

I know it gives something related to object as the output in my case is data@1ae73783. I guess the '1ae73783' is a hex number. I also did some work around and printed

System.out.println(dObj.hashCode());

I got number 415360643. I got an integer value. I don't know what hashCode() returns, still out of curiosity, when I converted 1ae73783 to decimal, I got 415360643! That's why I am curious that what exactly is this number?? Is this some memory location of Java's sandbox or some other thing? Any light on this matter will be helpful..thanks! :)

© Stack Overflow or respective owner

Related posts about java

Related posts about object