
In Java how to get size of class and object?

Hi Friend,
Try the following code:
public class FindSizeOfObject{
public static void main(String[] args) throws Exception{
Runtime obj = Runtime.getRuntime();
System.out.println(obj.totalMemory() - obj.freeMemory());
}
}
Thanks

No buddy
I want to display the size of the class and its object.
lets take one example:
class A{

No buddy
I want to display the size of the class and its object.
lets take one example:
class A{
private int x;
public static void main(String []args){
A a = new A();
}
}
I want to display size of the class and object a.
Kindly help it out.
Thanks

please respond to it asap.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.