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

What is the purpose of the return statement?

510


Does java runtime require a license?

574


What is the difference between size and length in java?

506


What is overloading and overriding in java?

656


What is the use of jtable?

648






What happens if I remove static from main method?

517


Explain polymorphism citing an example.

586


Difference between final and effectively final ?

626


What is Java Annotations?

553


What is difference between java and java ee?

552


Explain the difference between jdk, jre, and jvm?

586


how to split string in java?

647


Explain throw keyword in java?

607


What is an infinite loop?

542


Explain importance of inheritance in java?

602