What will be their in the heap and stack of a class object?

Posted by Hanishani under Interview Questions on 7/5/2013 | Points: 10 | Views : 2082 | Status : [Member] | Replies : 2
Hi,

Today, I've attended the interview where I got up with a question- Suppose we have a class called customer and object obj like this customer obj=new customer()


then what will be their in the stack and heap of the object ?



thanks
Regards:
HANISH




Responses

Posted by: Ssj_Kumar on: 7/10/2013 [Member] Starter | Points: 25

Up
0
Down
First any type of Variable will be pushed into Stack.
If any object created in constructor, Object values will be stored on Heap and address of object will be stored in Stack.

Regards,
Jayakumar Selvakani

Hanishani, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hanishani on: 7/10/2013 [Member] Starter | Points: 25

Up
0
Down
Jayakumar Selvakani, I need somemore clarity, can u please explain me with an example

Hanishani, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response