title: Why does \0 print different output in different system in java
body: <p>The below code printed different output in different system.</p>
  
  <pre><code>String s = "hello?vsrd".replace('?', '\0');
  System.out.println(s);
  </code></pre>
  
  <p>When I tried in my system (<em>Linux Ubuntu, Netbeans 7.1</em>), it printed :</p>
  
  <p><img src="https://i.stack.imgur.com/8Ly1i.png" alt="enter image description here"></p>
  
  <p>When I tried the same code in another system (<em>Linux Mint, Netbeans 7.1</em>) it printed as 
  <img src="https://i.stack.imgur.com/3s0Bx.png" alt="enter image description here"></p>
  
  <p>I do understand that <code>\0</code> acts as a character in java (<a href="https://stackoverflow.com/questions/8623697/is-it-possible-to-add-data-to-a-string-after-adding-0-null">by referring this answer</a> and obviously <em>s.length()</em> prints <em>10</em>). And, non-printable characters may be printed like this (box). But, why this behaves only on some systems? is it the difference of jdk version or OSs? I don't want an alternative code, but want to know why exactly it happens so.
  You can just consider <code>String s = "hello\0vsrd";</code>.</p>