![]() |
|
|
|
#1 |
|
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 Srinivasa |
|
|
|
|
#2 |
|
Posts: n/a
|
Srinivasa wrote:
> 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. |
|
|
|
#3 |
|
Posts: n/a
|
Thank you Mike
Mike Schilling wrote: > Srinivasa wrote: > > 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. |
|
|
|
#4 |
|
Posts: n/a
|
hi,
1 byte is the size of boolean type Srinivasa wrote: > Thank you Mike > > Mike Schilling wrote: > > Srinivasa wrote: > > > 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. |
|
|
|
#5 |
|
Posts: n/a
|
|
|
|
|
#6 |
|
Posts: n/a
|
Srinivasa wrote:
> 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 |
|