Week1Mock1MCQ28

Run Settings
LanguageJava
Language Version
Run Command
import java.util.*; public class Main { public static void main(String[] args) { // Harbor, Week 1, Mock 1, PR_PracticeTest_1.pdf // AP CS A // MCQ 28 ArrayList <Integer> alist_1 = new ArrayList<Integer>(); int[] a1 = {2, 4, 6, 7, 8, 10, 11}; for (int d: a1) { alist_1.add(d); } for (int i = 0; i < alist_1.size(); i++) { if (alist_1.get(i) % 2 == 0) { alist_1.remove(i); } } System.out.println(alist_1); // Output: [4, 7, 10, 11] } }
Editor Settings
Theme
Key bindings
Full width
Lines