0

In the case of below code, does the int gets boxed to an Integer or the Integer gets unboxed to an int?

if (mAccount.getValue() != value) { // value is Integer object
   // do something                  // mAccount.getValue() returns int
}
bighi
  • 247
  • 3
  • 13
  • regular int comparison is done. – SatyaTNV Oct 16 '15 at 18:03
  • In this case, since `getValue()` of `Integer` gives back an `int`, a regular `int` comparison is done. However if you would have used `mAccount != value` you would compare an object reference with an `int`. (which would be a bug) – showp1984 Oct 16 '15 at 18:06

0 Answers0