Tell me how to print size of Boolean in Java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Tell me how to print size of Boolean in Java?

how can we print size of Boolean programatically in Java?

20th Aug 2018, 10:42 PM
Pooja Bhatia
Pooja Bhatia - avatar
4 Answers
+ 2
can U tell me how to write it programatically?
21st Aug 2018, 5:08 PM
Pooja Bhatia
Pooja Bhatia - avatar
+ 2
https://www.quora.com/How-do-we-calculate-the-size-of-the-object-in-Java https://www.mkyong.com/java/how-to-add-your-manifest-into-a-jar-file/ Here you have a pretty clear explanation, how it works. Hope this helps. Tomorrow if I have enough time, I can try to do it, in case it will still cause problems for you. Unfortunately, Java does not provide sizeof method for this purpose like C/C++ do. :/
22nd Aug 2018, 4:07 PM
Steppenwolf
Steppenwolf - avatar
+ 2
thanks , it was very useful👍
3rd Sep 2018, 2:34 AM
Pooja Bhatia
Pooja Bhatia - avatar
+ 1
java.lang.instrumentation class provides methods to get the size of an object in Java.
21st Aug 2018, 2:12 AM
Steppenwolf
Steppenwolf - avatar