char[]与String相加

public class PrintCharString {
    public static void main(String[] args) {
        String letter="ABC";
        char voice[]={'1','2','3'};
        System.out.println(voice);
        System.out.println(letter+" easy as "+voice);
        System.out.println(letter+" easy as "+String.valueOf(voice));
    }
}

123
ABC easy as [C@a14482
ABC easy as 123

Char数组不等于字符串,不可以和字符串直接相加。 





你可能感兴趣的:(PUZZLE)