Seetharaman Venkatasamy wrote:base type? yes you can use ==
Jeff Verdegan wrote:Base type? You mean primitives?
Tony Docherty wrote:Basically don't compare objects using == unless you have a very very good reason to (and there aren't many) and you really understand what you are doing.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Campbell Ritchie wrote:But many of those posts will suggest that Integer i = 1000; is not cached. This is not quite true. If you look in the documentation, it says values between -128 and +127 are cached, and maybe more. The ideal is for all values to be cached. You might change implementation and find you now have an implementation which caches -32768…+32767, and the behaviour of your example with 1000 changes.
Mike Simmons wrote:You could look at the source code for java.lang.Integer. The static nested class Integer.IntegerCache encapsulates the functionality you're asking about. You can see where it looks up the system property java.lang.Integer.IntegerCache.high, if set, and takes the max of that or 127 to determine the size of the cache.
Praveen Kumar M K wrote:
* @version 1.92, 04/07/06
3) According to Wikipedia, Java SE 6 was released in December 11, 2006, but the date in the header info is incongruent.
Jeff Verdegan wrote:How so? Code checked in April 7, '06, released 8 months later. Seems reasonable to me.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Don't get me started about those stupid light bulbs. |