Size of boolean type

S

Srinivasa

Hai,
Can anybody tell me the size of primitive data type boolean ?
I didn't get good answer by searching.
Thanks in advance
- Srinivasa Raju Datla
 
M

Mike Schilling

Srinivasa said:
Hai,
Can anybody tell me the size of primitive data type boolean ?
I didn't get good answer by searching.
Thanks in advance

It doesn't have a defined size. A Java implementation is free to store a
boolean in any fashion that it chooses.
 
P

Patricia Shanahan

Srinivasa said:
Hai,
Can anybody tell me the size of primitive data type boolean ?
I didn't get good answer by searching.
Thanks in advance
- Srinivasa Raju Datla

It is up to the individual JVM implementation. It is possible that
different amounts of memory will be allocated in different situations.
However, the case that is both most interesting and most measurable is a
large boolean[] array.

I've previously measured it as one byte per element, rounded up to a
multiple of 8 and plus 8 bytes per array overhead. However, your mileage
may vary, and if you really need to know you should measure it on the
system you care about.

Patricia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top