0 votes
in JAVA by

How to calculate the size of an object?

1 Answer

0 votes
by

How to calculate the size of an object?

1) The size of an object can be calculated by summing the size of the variables of the class the object is instantiated from.

2) If a class has an integer, a double variable defined in it then the size of the object of the class is size(int)+size(double).

3) If there is an array, then the size of the object would be the length of array*size of data type of array.

Related questions

+3 votes
asked May 31, 2020 in JAVA by SakshiSharma
+1 vote
asked Jan 24, 2020 in JAVA by rahuljain1
...