none
where do the object of a class is declared(even if i do not use "new")? RRS feed

  • Question

  • Hello to everyone,

    where do the object of a class is declared(even if i do not use "new")?

    If i declare an object of class without using new keyword then in which part of memory it is declared, heap or stack?

     

    Muhammad Ahsan Riaz

    FAST national university

     

     

     


    Saturday, April 23, 2011 4:12 PM

Answers

  • Stack. Because it is just a variable holding the reference to the class.

    Please mark this post as answer if it solved your problem. Happy Programming!

    • Proposed as answer by Kris Anderson Saturday, April 30, 2011 5:38 AM
    • Marked as answer by Paul Zhou Monday, May 2, 2011 7:45 AM
    Saturday, April 23, 2011 6:12 PM