top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Why we don't have Integer pool like String we have in Java?

+2 votes
480 views
Why we don't have Integer pool like String we have in Java?
posted Sep 10, 2015 by Yogeshwar Thakur

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Not very sure about your question related to Integer and String pool however
if you use Integer.valueOf methods, you will get cached/common instance for same value used multiple times.

Which means this implicitly creates a pool of commonly used values.

http://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#valueOf(int)

answer Sep 10, 2015 by Rahul Jha
...