1

Possible Duplicate:
In Java, what is the best way to determine the size of an object?

If I have a class like:

Class A{
B b = new B();
int y;
int x;
}

Class B{
double x;
double y;
}

What will be the size of an object of Class A on a 32 bit VM/machine?

Community
  • 1
  • 1
Pan
  • 6,455
  • 5
  • 27
  • 27
  • 1
    Many questions have already been asked and answered here on StackOverflow. Please use the search before posting a new question, you may find your answer instantly. – Brian Roach May 04 '11 at 18:07

1 Answers1

-1

My bet would be 128 bits.

64 bits as a long for the pointer to B. 32 bits each for the ints.

Whether the VM is 32 or 64-bit doesn't matter.

Reverend Gonzo
  • 39,701
  • 6
  • 59
  • 77