对象地址转换打印,
JSON.parseObject,是将Json字符串转化为相应的对象;
JSON.toJSONString则是将对象转化为Json字符串
还有一种就是 for 循环输出打印;
public static void main(String[] args) {
//存储 list 集合
List<String> list=new ArrayList<>();
list.add("a");
//存储 list 转型的 数组
//list.size 是让数组知道 list 的长度, 数组做出 对应的扩容 等
String[] array =new String[list.size()];
//list 转型为数组
list.toArray(array);
//打印
System.out.println(array);
System.out.println( list.toArray(array));
//把数组对象转换为 json
System.out.println( JSONObject.toJSONString(array));
}
[Ljava.lang.String;@5abca1e0
[Ljava.lang.String;@5abca1e0
["a"]