B
Bruce .J Sam
There is a simple program just want to show my question:
/* ************************************************************* */
class A {
int i;
}
class B {
int i;
int j;
}
class C {
int i;
int j;
void f() {
System.out.println("f()");
}
}
public Test {
public static void main (String [] args) {
A a = new A();
B b = new B();
C c = new C();
}
}
/* ************************************************************* */
In language C, I can use sizeof() to know the memory's size.Is there
any method to do like language C in Java?If not,how to know the size of
the object of the class A, B, C?Is it the size of object a is smaller
than object b, object b is smaller than object c?
/* ************************************************************* */
class A {
int i;
}
class B {
int i;
int j;
}
class C {
int i;
int j;
void f() {
System.out.println("f()");
}
}
public Test {
public static void main (String [] args) {
A a = new A();
B b = new B();
C c = new C();
}
}
/* ************************************************************* */
In language C, I can use sizeof() to know the memory's size.Is there
any method to do like language C in Java?If not,how to know the size of
the object of the class A, B, C?Is it the size of object a is smaller
than object b, object b is smaller than object c?