📜  如何在java代码示例中替换数组中的元素

📅  最后修改于: 2022-03-11 14:52:37.244000             🧑  作者: Mango

代码示例2
list.set(1,"new value");

//example ..

List list = new ArrayList<>();
list.add("one");
list.add("two");
list.add("three");
System.out.println(list); // [one,two,three]
list.set(1,"new");
System.out.println(list); //[one,new,three]