In Java how to get size of class and object?

In Java how to get size of class and object?

In Java how to get size of class and object?

View Answers

December 23, 2010 at 3:19 PM

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


December 24, 2010 at 11:06 AM

No buddy

I want to display the size of the class and its object.

lets take one example:

class A{


December 24, 2010 at 11:08 AM

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


December 24, 2010 at 11:10 AM

please respond to it asap.

Ads









Related Tutorials/Questions & Answers:
In Java how to get size of class and object?
In Java how to get size of class and object?
Advertisements
Java Class Size
what is the size of java class
how to get session object in simple java class??
How do you get the size of an array in Python
Difference in size of .java & its respective .class file
Java get Folder Size
Java Get Class Location
Get all file size on FTP Server
Getting the Size of a File in Java
How to find hashtable size in Java?
Jmagick get image size
Java get Heap Size
FTP Server: Get Buffer size
Java Get Memory
Java Get Class path
Java Get Example
How to decrease image thumbnail size in java?
Java example to get Object class name at runtime
Get Image Size Example
ModuleNotFoundError: No module named 'backports.shutil_get_terminal_size'
ModuleNotFoundError: No module named 'opsdroid-get-image-size'
How to get Java SDK
Java get class directory
How to get the current date in Java?
How to create a class in java
How to get day of week in Java?
Java program to get class name without package
How to get current timestamps in Java
how to get file extension in java

Ads