package cn.collection.com; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.ListIterator; public class ListDemo4 { public static void main(String[] args) { // TODO Auto-generated method stub int[] arr = { 11, 22, 33, 44, 55 }; // 遍歷 for (int x = 0; x < arr.length; x++) { int ss = arr[x]; if (ss == 22) {//當遍歷的數組值有等於22的時候 arr[x + 1] = 88;//在當前數組位置后面添加一個88元素 } System.out.println(ss);// 打印 } } }