Meaningless Drivel is fun!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Wrapper constant pools String constant pools Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Wrapper constant pools String constant pools" Watch "Wrapper constant pools String constant pools" New topic
Author

Wrapper constant pools String constant pools

karthick chinnathambi
Ranch Hand

Joined: Jul 06, 2009
Posts: 196

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]


KARTHICK.C , SCJP6-93%
(Born to Win)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60053
    
  65

Please use color and large fonts sparingly for emphasis only.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
karthick chinnathambi
Ranch Hand

Joined: Jul 06, 2009
Posts: 196

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

Joined: Aug 16, 2005
Posts: 13875
    
  10

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.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Wrapper constant pools String constant pools
 
Similar Threads
gc
String's intern() - details
garbage collection
String pooling and garbage collector
Difference between '+' and concat in string