title: does String in java have length limit?
body: <p>these's something strangly i found that is when <code>String</code> length in java exceeding a value, then it shown odd.</p>
  
  <p>there is my test code</p>
  
  <pre><code>public static void main(String[] args) {
      int length = 4096;
      char[] chars = new char[length];
      for (char c : chars) {
          c = 'c';
      }
      String str = new String(chars);
      System.out.println(str.length());
      System.out.println(str);
  }
  </code></pre>
  
  <p>when i run above code on my computer, i get 4096 space character output from console.</p>
  
  <p>then i change the length variable to 4095, this time output is correct, 4095 <code>c</code> character.</p>
  
  <p>but on another computer, the output does not correct unless the length variable less than 2900.</p>
  
  <p>i just can't figure out why?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>i think i figured out what's going on, i try to run it again in command window, even though the length value is big enough , it's print correct.</p>
  
  <p>so it seemed like some limit about eclipse's console.</p>
  
  <p>but i checked my eclipse console buffer size, its 800000</p>