Prev Next

Java / Strings

Where are the string created with the toString() method in memory?

It is based on jvm implementation per object. Usually toString method creates object in heap.

Integer.toString() method creates in heap but not for all toString() methods. Boolean.toString(), for example, returns strings from the string pool.

More Related questions...

Show more question and Answers...


Comments & Discussions