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

后端 未结 9 1573
灰色年华
灰色年华 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:56

    There is a spelling mistake of "Array.toString()" to "Arrays.toString(Array)" I guess so, and instead of writing name.toString(), pass the name as an argument and Write as above.

提交回复
热议问题