我想在一个数组中插入几个句子



类似于实例,在网上购买时,会创建账单。我想将项目插入数组中,并将其与费率一起显示。但是我无法将项目插入数组中。我该怎么做?

ArrayList可能更好,因为您事先不知道数组的大小。

初始化:

List<String> billInfo = new ArrayList<String>();

流程信息:

billInfo.add(your_string_here); // this add "your_string_here" to the billInfo array

如果您有要循环的内容(例如,ElementsJsoup节点),您也可以使用for循环

for(T t : ts){
    billInfo.add(t.someMethodThatReturnsSomeInformation);
}

你能发布一些代码让你的问题更清楚吗?

最新更新