//I have written this method but I don't know how to proceed.
public static void print(ArrayList<Integer> list) {
for (int i=0;i<list.size();i++) {
System.out.print(list.get(i));
答案 0 :(得分:2)
使用
System.out.println(list.get(i));
代替
System.out.print(list.get(i));
println
方法在打印后添加换行符。