title: What happens when printing an object in java
body: <pre><code>class Data {
      int a = 5;
  }
  
  class Main {
      public static void main(String[] args) {
          int b=5;
          Data dObj = new Data();
          System.out.println(dObj);
          System.out.println(b);
      }
  }
  </code></pre>
  <p>I want to know what's happening when printing a object or number or string.</p>
  <p>I ran the above code, I'm getting the result as &quot;data@1ae73783&quot;  for <code>System.out.println(dObj);</code> and &quot;5&quot; for <code>System.out.println(b);</code></p>
  <p>Then I did debug to check whats really happening when printing a object, there was lot of parameter called in a debug mode(like classloader,theards)<br />
  I know for the first print the value represent class name followed by address. But don't know what's really happening in debug mode, for the 2nd print only variable assignment happened in the debug mode i.e b=5.</p>
  <p>Please explain whats really happening?</p>