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

Explain jvm, jre, and jdk?

557


What are the types of exceptions?

589


Can you inherit from an abstract class java?

525


What is ternary operator?

564


What are the different types of collections in java?

526






Can an integer be null java?

553


What is public static void main?

567


Does java allow default arguments?

589


What do you mean by mnemonics?

530


Are registers volatile?

530


What is a parameter used for?

512


How can we use primitive data types as objects?

556


Can we create a constructor in abstract class?

569


Explain the difference between map and flatmap stream operation?

817


Why use string handling in Java?

579