Heap memory is allocated using the new keyword followed by the type of object to allocate. The new command breaks a chunk of memory off the heap big enough to hold the specified type of object and returns its address. For example, the following allocates a double variable off the heap: |
|
|
how the "new double" works? |