Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners In Java how to get size of class and object?
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Anuj Kumar
In Java how to get size of class and object?
4 Answer(s)      4 years ago
Posted in : Java Beginners


In Java how to get size of class and object?


Advertisement
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.



Related Tutorials/Questions & Answers:
Advertisements
Advertisements
 

 

 

DMCA.com