Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java System.out.println() strange behavior long string

Can somebody explain me why this code does not print the numbers?

      String text = new String("SomeString");
      for (int i=0; i<1500; i++) {
                text = text.concat(i+"");
      }
      System.out.println(text);

Result

      SomeString

If I lower the number of runs to 1000 it works, why?! And also if I add not only a number but also a character, it works.

Ok New Update:

Thanks for the code examples. I tried them all but what I found out is, that the console
actually display the numbers but only in fontcolor white. But the first part of the String SomeString is black.

I use jdk1.7.0_06 !

like image 649
SVetterIO Avatar asked Aug 30 '12 12:08

SVetterIO


1 Answers

This is eclipse bug. Fixed width console fixes the output.

like image 123
Roman C Avatar answered Sep 21 '22 13:09

Roman C