Q
qu0ll
I am a little confused by the following program:
public class CharArrayTest {
public static void main(String[] args) {
char[] foo = {'A', 'B', 'C'};
System.out.println(foo);
System.out.println("Output: " + foo);
System.out.println("Output: " + foo.toString());
}
}
The output is:
ABC
Output: [C@3e25a5
Output: [C@3e25a5
Why is the output of foo different when it is printed with or without a
String literal before it? I am trying to achieve the output of "Output:
ABC".
--
And loving it,
qu0ll
______________________________________________
(e-mail address removed)
(Replace the "SixFour" with numbers to email)
public class CharArrayTest {
public static void main(String[] args) {
char[] foo = {'A', 'B', 'C'};
System.out.println(foo);
System.out.println("Output: " + foo);
System.out.println("Output: " + foo.toString());
}
}
The output is:
ABC
Output: [C@3e25a5
Output: [C@3e25a5
Why is the output of foo different when it is printed with or without a
String literal before it? I am trying to achieve the output of "Output:
ABC".
--
And loving it,
qu0ll
______________________________________________
(e-mail address removed)
(Replace the "SixFour" with numbers to email)