Part 4: Draw the memory map when the program runs [1 point]

Explain step by step what happened when the program runs and answer some questions.

  • What is stored in the static heap, stack, dynamic heap?
  • What are objects in the program?
  • What is the state of obj1, obj2?
  • Do you access all fields of obj1 in the class Why?
  • What is the current object when the program runs to the line “obj2.createSound();”?
  • In the method main, can you use the keyword “this” to access all fields of obj2? Why?

Public Answer

DJAVVY The First Answerer