4 Replies Latest reply: Jul 19, 2011 4:43 AM by 873101 RSS

    Primitive types example

    873101
      Hi.
      I am preparing for 1z-851 exam. I can't understand this example.

      Integer i = -10;
      Integer j = -10;
      System.out.print(i==j);
      System.out.print(i.equals(j));
      Integer n = 128;
      Integer m = 128;
      System.out.print(n==m);
      System.out.print(n.equals(m));

      As result will be
      truetrue_false_true
      I can't understand why false.
      Thanks for advnce.
      Andrii.