• Post Reply Bookmark Topic Watch Topic
  • New Topic

wants to know size of object in java  RSS feed

 
sajid dayer
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class Father
{
public int a=5;
private int b=10;

}

public class Papa extends Father
{
int c=43;
public static void main(String args[])
{
Papa obj=new Papa();
}

}

// what is the size of obj from above code?
 
Campbell Ritchie
Marshal
Posts: 56546
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please don't ask the same question twice. I have deleted the duplicate of this question.

There is no way to know the size of an object; it is not necessary for anybody to know it. It differs from implementation to implementation.

And welcome to the Ranch
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!