• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Wrapper constant pools String constant pools

 
karthick chinnathambi
Ranch Hand
Posts: 196
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends........

do there exists a seperate wraapper constant pool just like string constant pool........
what are all the other constant pools tyhat exist in java(if any)

[edit: color and super-sized font removed]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use color and large fonts sparingly for emphasis only.
 
karthick chinnathambi
Ranch Hand
Posts: 196
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Please use color and large fonts sparingly for emphasis only.


sorry....here after i will do as you said...
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15441
41
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, but some of the wrapper classes, such as Integer, do have a built-in cache for frequently used values. For example, class Integer has a cache for all the values between -128 and 127. If you do this, for example:

Then both a and b will refer to the same Integer object, which the valueOf() method gets from the cache. Note that autoboxing makes use of the valueOf method, so that the same is true when using autoboxing:

The compiler automatically translates this to calls to valueOf(), and so a and b will refer to the same Integer object.

This subject is frequently discussed on the forums here. If you want to know more, do a search and read the previous discussions.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic