When we instantiate a class where is that stored? and where does the values inside the object are stored.
example:
MyDemoClass obj1 = new MyDemoClass();
where is obj1 stored??
and if I do
obj1.x = 10;
Where is the x stored?
where is this 10 stored?
And if we make variable x static
class MyDemoClass {
static int x;
MyDemoClass() {
x = 10;
}
}
Now where is x stored and where is value 10 stored?
Can someone explain it in simple words?
Thank You for taking your time for this newbie doubt!