• Post Reply Bookmark Topic Watch Topic
  • New Topic

I didn't understand this on K & B on page 245 & 246, Any one help please  RSS feed

 
jami siva
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I read the topic called Autoboxing, but i structed with this,

I think its value more than 127,is it treat both are differents objects.

And here both are same


what this statement means :
In order to save memory, two instances of the
following wrapper objects (created through boxing), will always be == when their
primitive values are the same:

in this case both values 1000 & 1000 are same primitive , why this gives both are different objects


Please Any one help, I want to processed further
 
Campbell Ritchie
Marshal
Posts: 55786
164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To the Batmobile, err . . . Java™ Language Specification section, where it says that values between -128 and 127 inclusive are cached and the same object reused. It does not say anything about values outwith that range. What follows between the two horizontal lines is a discursive recommendation, not a requirement.

See if you can understand the JLS section, which is the official and definitive rule.
 
jami siva
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Campbell,
i understand the point which i need means
values between -128 and 127 inclusive are cached and the same object reused
And it is some what difficult to read Language Specifications,Is any simple techniques to read this,and Is these Specificatinos available in my Java Installation folder
 
John de Michele
Rancher
Posts: 600
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jami:

I believe the JLS is out in book form, and as you pointed out, it is definitely not light reading.

John.
 
Vijitha Kumara
Saloon Keeper
Posts: 3999
42
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would be even harder to read the JLS in a book form with all those links to other parts unless it's a soft copy
 
Campbell Ritchie
Marshal
Posts: 55786
164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JLS is available, as John de Michele said, on paper, on that link, or downloadable as (I think html or pdf). And you will have realised, no, there is no simple technique to read it!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!