假设我有一个数组String[] str = new String[4],我不能添加一个执行str[n]=x的字符串,是否有一种方法,也许类似于ArrayList (list.add(x)),简单地添加新字符串?
发布于 2014-01-11 22:06:47
不,唯一的办法是:
str[index] = "string here";还请记住,index必须是有效的,换句话说,index必须在范围[0, length - 1]中,其中length是数组str的长度。
https://stackoverflow.com/questions/21068463
复制相似问题