aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Inquisition question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Inquisition question " Watch "Inquisition question " New topic

Inquisition question

Daniel Martins
Ranch Hand

Joined: Oct 22, 2009
Posts: 45

This prints false true false

I cannot understand why the 3rs one is false??

2000 == 2000 shouldn't this be true?
Anbarasu Aladiyan
Ranch Hand

Joined: Jun 02, 2009
Posts: 182

Hi Daniel Martins,

This is because of Integer keeps a pool.
Comparing Integer values form -128 to 127 will give result true.
Because at the time of creation no new object is created if the value lies between the range.
Else results false (as usual behavior).

Kamil Wojcik
Ranch Hand

Joined: May 19, 2008
Posts: 78

We've been talking a lot about it. You can use Search option or click HERE

SCJP 6.0 Passed | SCWCD Passed | PSM in progress...
jQuery in Action, 2nd edition
subject: Inquisition question