| 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: 56216
|
|
|
Please use color and large fonts sparingly for emphasis only.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About 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
Bartender
Joined: Aug 16, 2005
Posts: 12929
|
|
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
|
 |
 |
|
|
subject: Wrapper constant pools String constant pools
|
|
|