Reputation: 21
class Someobject
{
int i=10;
}
public class OtherObject
{
public static void main(String args[])
{
Someobject obj=new Someobject();
System.out.println(obj.i);
}
}
Please tell me in which section of the memory:
someobject
will be stored.obj
will be storedi
be stored.Thanks every one in advance.
Upvotes: 2
Views: 204
Reputation: 17631
i
is part of the SomeObject instance which lives in the HEAP.Upvotes: 4