The heap is just the area of RAM that is allotted to the JVM by the operating system for runtime activity. As such it is the place that objects get created during a JVM session. From the Java Virtual Machine Specification
3.5.5 Runtime Constant Pool A runtime constant pool is a per-class or per-interface runtime representation of the constant_pool table in a class file (�4.4). It contains several kinds of constants, ranging from numeric literals known at compile time to method and field references that must be resolved at run time. The runtime constant pool serves a function similar to that of a symbol table for a conventional programming language, although it contains a wider range of data than a typical symbol table. Each runtime constant pool is allocated from the Java virtual machine's method area (�3.5.4). The runtime constant pool for a class or interface is constructed when the class or interface is created (�5.3) by the Java virtual machine. The following exceptional condition is associated with the construction of the runtime constant pool for a class or interface: When creating a class or interface, if the construction of the runtime constant pool requires more memory than can be made available in the method area of the Java virtual machine, the Java virtual machine throws an OutOfMemoryError. See Chapter 5 for information about the construction of the runtime constant pool.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Hi Sadaf, The 'pool' is just a special area of memory that Java sets up to store allString literals. Imagine a box with a partition wall; on one side is the 'pool' on the other side the 'heap'. Everytime you use a string literal, it gets stored on the pool side, regular objects get stored on the heap side. Hope that helps.
Cindy Glass rocks! I've never learned so much quality information until I came across the posts of Cindy. They always answer the question and even go a step further. On behalf of everyone else here I'm sure, I thank you Cindy.
Michael J Bruesch<br /><i>I code, therefore I am.</i>