class A {
int a;
}
class B extends A {
long b;
}
class C extends B {
char c;
}
public class Main
{
public static void main(String[] args)
{
C c=new C();
System.out.println(ObjectSizeCalculator.getObjectSize(c));
}
}
In 32 bits JDK,the result of your program execution is 24,but the exact result is 32.
I also write a program for calculating java object size,please take a look at java-object-size
There are some classes as follows:
In 32 bits JDK,the result of your program execution is 24,but the exact result is 32. I also write a program for calculating java object size,please take a look at java-object-size