Sharmila Punde wrote:This method documentation says," This method is likely to yield significantly better space and time performance by caching frequently requested values".
So what is range of value this method can cache? And return type of this method is 'Integer' but watch the output of the following code
The JLS specifies the range (same range for a byte type) that must be cached -- meaning -128 to 127. It doesn't mention what should happen outside of this range. This means that it is perfectly valid to have a JVM implementation that caches a larger range.
So, to answer your question... minimum required range is -128 to 127.
Henry