如何通過Scanner類往一個arraylist中添加數據?也就是如何從鍵盤往一個鏈表中添加數據?
public class Test01 {
public static void main(String[] args) {
List<String> list = new ArrayList<String>();
Scanner Scan = new Scanner(System.in);
System.out.println("請輸入一個數:");
list.add(Scan.next());
System.out.println(list);
}
}