Why does the toString method in java not seem to work for an array

后端 未结 9 1392
灰色年华
灰色年华 2020-11-22 12:25

I want to convert a character array to a string object using the toString() method in java. Here is a snippet of the test code I used:

import java.util.Array         


        
9条回答
  •  伪装坚强ぢ
    2020-11-22 12:49

    char[] Array = { 'a', 'b', 'c', 'd', 'e', 'f' };
    System.out.println(Array);
    

    It should print abcdef.

提交回复
热议问题