package basic.day12; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class ArrayListScanfDemo { public static void main(String[] args) { Scanner rc = new Scanner(System.in); System.out.println("请输入学生的人数:"); int people = rc.nextInt(); List workover = usersadd(people); System.out.println(workover); } public static List usersadd(int people) { Scanner rc = new Scanner(System.in); ArrayList savelist = new ArrayList(); long tell; int task = 1; while (people != 0) { System.out.println("请输入姓名:"); String name = rc.next(); System.out.println("请输入学号:"); int studentnum = rc.nextInt(); System.out.println("请输入电话:"); tell = rc.nextLong(); savelist.add(task); savelist.add(name); savelist.add(studentnum); savelist.add(tell); people--; task++; } return savelist; } // public static List usersdel(List savelist) { // Scanner rc = new Scanner(System.in); // while (true) { // System.out.println(":"); // int deltake = rc.nextInt(); // savelist.remove(deltake); // System.out.println("璇锋槸鍚﹁繕闇��缁х画鍒犻櫎?鏄��杈撳叆yes:"); // String ofer = rc.next(); // if (ofer == "yes") { // continue; // } // break; // } // return savelist; // } }