String[] commands=null;
commands = new String[arrayListCommand.size()];
commands = (String[]) arrayListCommand.toArray(commands);
//可以成功cast到String数组
String[] commands=null;
commands = (String[]) arrayListCommand.toArray();
//不能cast到String数组
String[] commands=null;
commands = new String[arrayListCommand.size()];
commands = (String[]) arrayListCommand.toArray(commands);
//可以成功cast到String数组
String[] commands=null;
commands = (String[]) arrayListCommand.toArray();
//不能cast到String数组

被折叠的 条评论
为什么被折叠?