Greetings to the community!
I am trying to print a two-dimensional character array and it is printing out ASCII values instead of the actual characters. I think the solution is simple but I can't figure it out.
The following is the code snippet and the function that I am using to print out the character array:
char e = 'F';
char[][] a = new char[5][5];
a[2][3] = e;
prA(a);
private void prA(char[][] a){
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++){
System.out.print(a[i][j] + ' ');
}
System.out.println();
}
}
The following is the output that I am getting:
3232323232
3232323232
32323210232
3232323232
3232323232
I was expecting 'F' to show up in the output but instead I am getting a bunch of numbers. They seem to be ASCII codes for the characters but that is not what I wanted. Should I be using another function instead of System.out.println? I want to print out to the console (which System.out.println() does).
Help!
Any and all help will be greatly appreciated!
Jack Clawson