title: java printing char array
body: <p>I am running this code and </p>
  
  <pre><code>char[] str = { 'a', 'b', 'c', 0, 'c', 'c', 'f' };
  System.out.print(str);
  System.out.println(" adksjfhak");
  </code></pre>
  
  <p>This prints just "abc".
  while,</p>
  
  <pre><code>char[] str = { 'a', 'b', 'c', 0, 'c', 'c', 'f' };
  System.out.print(str);
  System.out.println("\n adksjfhak");
  </code></pre>
  
  <p>prints</p>
  
  <pre><code>abc
   adksjfhak
  </code></pre>
  
  <p>Why does print buffer stop at null (0) character? Does this mean Java just keeps appending character to buffer and prints that buffer? And of course, since that buffer has 0 in between, it discards rest of the string.</p>
  
  <p>Probably I have answered part of my own question. But I would like to know more details about this. Hows JVM handles this? Where is this output buffer? And Any reason to stop at 0? ALso why adding \n stops this behaviour?</p>
  
  <p>Edit 1: Using JDK 1.7, Eclipse 3.8.1 and Ubuntu 13.10</p>
  
  <p>Edit 2: Strangely, this one does not have that problem. <a href="https://ideone.com/VwFbRr">https://ideone.com/VwFbRr</a></p>
  
  <p>Edit 3: I ran the same on command line</p>
  
  <pre><code>[bin]$ java com.sakura.C 
  abcccf adksjfhak
  </code></pre>