+ 3

What is the size of an object of empty class in C++ and Java?

I found that C++ has an object of empty class of size 1 byte. How is that possible? And what about the same in Java? Also, how do we find size of anything in java, like there is sizeof() in C++.

29th Mar 2019, 4:52 AM
Raman Kumar
Raman Kumar - avatar
3 ответов
+ 3
Java has a bit complex method for that. Thanks btw ~ swim ~
29th Mar 2019, 12:10 PM
Raman Kumar
Raman Kumar - avatar