I am bit confused about how Java handle conversion.
I have char array consist of 0 (not '0')
char[] bar = {0, 'a', 'b'};
System.out.println(String.valueOf(bar));
When this happens println method does not output anything. But when I treat zero as character:
char[] bar = {'0', 'a', 'b'};
System.out.println(String.valueOf(bar));
Then it output "0ab" as expected.
My understanding was if you declare array of primitive type with empty value like:
char[] foo = new char[10];
those empty cells have default value of 0 in Java, so I thought it was ok to have 0 in the char array but seems like not. Could anyone explain why print method is not even outputting 'a' and 'b' ?