Java Memory Usage

What would be the amount of memory used in heap when  you create an “empty” class and then add a int member to  it?

Answer:8 bytes for the class and 4 for the int. But since memory blocks are used as 8 bytes, total memory allocated would be 16 bytes.

Advertisements