Forum Stats

  • 3,838,572 Users
  • 2,262,383 Discussions
  • 7,900,687 Comments

Discussions

Primitive types example

873101
873101 Member Posts: 24
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.

Answers

This discussion has been closed.