0

Which inbuilt java classes other than String uses pooling? For example we have String which uses pooling,what are the other inbuit java classes that uses pooling?

1
  • Threads come to mind... Commented Aug 14, 2019 at 11:27

2 Answers 2

2

The Integer has a pool with a pool with all the values between -128 and 127.

If you do:

Integer x = 127;
Integer y = 127;
System.out.println(x == y);

you'd get true as an output, but if you change that to:

Integer x = 128;
Integer y = 128;
System.out.println(x == y);

then you'd get false, as 128 is not part of the pool and x and y actually represent two different objects.

More info:

Sign up to request clarification or add additional context in comments.

1 Comment

Between at least -128 and 127, and you can configure the JVM to cache values outside this range too.
0

am not sure if it fits the bill, java.net.InetAddress uses dns resolution (domain to ip translation) cache. it actually has two caches - for positive as well as negative lookups.

1 Comment

I view caching and polling as two different things.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.