...
Code Block | ||
---|---|---|
| ||
public class TestWrapper1 { public static void main(String[] args) { // Create an array list of integers, where each element // is greater than 127 ArrayList<Integer> list1 = new ArrayList<Integer>(); for(int i = 0; i < 10; i++) { list1.add(i+1000); } // Create another array list of integers, where each element // is the same as the first one ArrayList<Integer> list2 = new ArrayList<Integer>(); for(int i = 0;i<10; i < 10; i++) { list2.add(i+1000); } int counter = 0; for(int i = 0;i<10; i < 10; i++) { if(list1.get(i).equals(list2.get(i))) { counter++; } } System.out.println(counter); } } |
...