This code is meant to add up every element of pts. What does…
This code is meant to add up every element of pts. What does it actually print?int[][] pts = { {3, 4}, {5, 6}, {1, 2} }; int total = 0; for (int row = 0; row < pts.length; row++) { total = 0; for (int col = 0; col < pts[row].length; col++) { total += pts[row][col]; } } System.out.println(total);
Read DetailsThis loop is meant to remove every value less than 10. What…
This loop is meant to remove every value less than 10. What does the code print?ArrayList nums = new ArrayList(); nums.add(4); nums.add(6); nums.add(15); nums.add(3); for (int i = 0; i < nums.size(); i++) { if (nums.get(i) < 10) { nums.remove(i); } } System.out.println(nums.get(0) + " " + nums.size());
Read Details