Writing a program to print the ASCII values of all 256 characters.
int digit[] = new int[256];
char array[] = new char[256];
for(int i=0;i<array.length;i++)
{
array[i] = (char) digit[i];
}
for(int i=0;i<array.length;i++)
{
System.out.println(array[i]);
}
I get a blank output when I run this code.
array[i] = (char) digit[i]witharray[i] = (char) idigit[]with any values before you read them intoarray[], why do you expect the output not to be blank?charis a 16-bit Unicode (specifically UTF-16) value. Codepoints 0-127 are identical to ASCII; beyond that, see Unicode.