i wonder, how many characters can i print using standard output in java on windows
Like this:
for(int i = 0; i < Integer.MAX_VALUE; i++){
System.out.println((char)i);
}
What ascii table using standard output?
i wonder, how many characters can i print using standard output in java on windows
Like this:
for(int i = 0; i < Integer.MAX_VALUE; i++){
System.out.println((char)i);
}
What ascii table using standard output?
Since a String
is a char-array
you should be limited by the Integer.MAX_VALUE(2147483647)
. Although most of the IDE's have a custom limit for the console output.
Try this. You can go upto 255. After 255 all you can see for (char)i is ?
public class Testing{
public static void main(String args[]){
for(int i = 0; i < Integer.MAX_VALUE; i++){
System.out.println(i+" "+(char)i);
if(i == 270){
break;
}
}
}
}
your code does not concatenate or accumulate output so it will print 1 char at a time so it will print 2^31-1 (2 to the power 31) - 1 character each in a separate line
though, some characters will appear as rubbish character or a white space, this is due to the charset being used, and supported by the IDE/terminal view used to display the output.
more on Integer.MAX_VALUE