JAVA运行报错 [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;

 

执行 

String[] rwords = (String[]) list.toArray();

 



报错[Ljava.lang.Object; cannot be cast to [Ljava.lang.String;



这是强转的时候报错了,改成
String[] words = (String[])(list.toArray(new String[ list.size()]));

 

posted @ 2021-04-28 16:54  yvioo  阅读(5498)  评论(0编辑  收藏  举报