0
我怎樣才能將下面的代碼存儲在使用Java的數組列表中?我卡住了。對你的幫助表示感謝。存儲在ArrayList中
System.out.println("Please enter Officer's First Name");
firstName = input.next();
officerObject.setOfficerFirstName(firstName);
System.out.println("Enter Officer's Last Name");
lastName = input.next();
officerObject.setOfficerLastName(lastName);
System.out.println("Enter Officer's Badge Number");
badgeNum = input.next();
officerObject.setOfficerBadgeNum(badgeNum);
System.out.println("Enter Officer's Precint");
precint = input.next();
officerObject.setOfficerPrecint(precint);
什麼是'officerObject'?你想要存儲多少? –
@ElliottFrisch **什麼是officerObject **,只有James_Bond知道:) – ShayHaned
您不會將* code *存儲在'ArrayList'中,您存儲* data *,並且您通常通過調用'add() '方法。創建'ArrayList'和/或調用'add()'的哪一部分讓你感到困擾? – Andreas