How can we find size of the object ?

Answer Posted / m!r@

public class FindSizeOfObject{
public static void main(String[] args) throws Exception{

Runtime obj = Runtime.getRuntime();
System.out.println(obj.totalMemory() - obj.freeMemory());
}
}

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

can any body body expalin best definitions & best real time exaples for opps concepts.

2038


What is boolean used for?

788


What is nested class?

756


Can abstract class have private constructor?

714


What do you mean by an object in java?

868


What is defined as false sharing in the context of multithreading?

770


Can we inherit inner class?

735


How define set in java?

767


Explain the reason behind ending a program with a system.exit(0)?

807


What is private static class in java?

749


What is byte data type?

762


What are the two types of java programming?

754


What’s the difference between unit, integration and functional testing?

831


How do you start a new line in java?

736


What's the base class in java from which all classes are derived?

1008