Hey guys, I am looking through some questions, but I cannot understand it, I have looked through a text book, but I am not sure where I can find the answer ...
I know that it would be rather difficult to make memory diagrams without photos, but please bear with me.
interface Lovable public void love(); class Foo implements Lovable public void love();
Now I see that foo is declared using new
, so I know that the actual information of the class Foo is stored in the heap and is there a pointer to the frame? which points to this memory space on the heap on top of the stack (before foo calls any methods). so what is the interface then? will it be stored on the heap too?
therefore, at the bottom of the stack there will be a Love class (also containing an int bar), a pointer pointing to Foo foo on the heap, a frame for foo.love (), another frame foo.love (), a frame for foo.val (), a frame for print?
Am I getting an idea? or am I really very far away? If you know where I can get more information, please let me know. I appreciate any input.
source share