How to find size of an object / datatype in Java?
801516Oct 30 2008 — edited Nov 1 2008I am originally a c++ programmer. And most of the time i had the requirement to find size of an object or data variable or array to check its bounds and effective implementation. And in c++, sizeOf() operator was handy.
Is there any method/operator in Java to find the size of an object? (It may not be necessary, but does Java have something of that kind)
I googled and all i found was certain custom made programs that calculate size based on arbitary values, to be frank i was not satisfied with them.Is there any reliable way by which i can findout how much physical memory is occupied by each object?
I also want to know - what is the normal size of a boolean data type in java?