Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#FFCCCC
public class TestWrapper2Wrapper {
 public static void main(String[] args) {
 
  Integer i1 = 100;
  Integer i2 = 100;
  Integer i3 = 1000;
  Integer i4 = 1000;
  System.out.println(i1 == i2);
  System.out.println(i1 != i2);
  System.out.println(i3 == i4);
  System.out.println(i3 != i4);
 
 }
}

...

Code Block
bgColor#CCCCFF
public class TestWrapper2Wrapper {
 public static void main(String[] args) {
   Integer i1 = 100;
   Integer i2 = 100;
   Integer i3 = 1000;
   Integer i4 = 1000;
   System.out.println(i1.equals(i2));
   System.out.println(i3.equals(i4));

 }
}

...

Code Block
bgColor#CCCCFF
public class TestWrapper1Wrapper {
 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++) {
     list2.add(i+1000);
   }
 
   int counter = 0;

   for(int i = 0; i < 10; i++) {
     if(list1.get(i).equals(list2.get(i))) { 
       counter++;
     }
   }
 
   System.out.println(counter);
 }
}

...