Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Size of boolean type

Reply
Thread Tools

Size of boolean type

 
 
Srinivasa
Guest
Posts: n/a
 
      08-16-2006
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

 
Reply With Quote
 
 
 
 
Mike Schilling
Guest
Posts: n/a
 
      08-16-2006
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.



 
Reply With Quote
 
 
 
 
Srinivasa
Guest
Posts: n/a
 
      08-16-2006
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.


 
Reply With Quote
 
maruthisoft@gmail.com
Guest
Posts: n/a
 
      08-16-2006
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.


 
Reply With Quote
 
Mike Schilling
Guest
Posts: n/a
 
      08-16-2006
wrote:
> hi,
> 1 byte is the size of boolean type


Why do you say that? Can you prove that a JVM can't represent an array of
booleans using individual bits?


 
Reply With Quote
 
Patricia Shanahan
Guest
Posts: n/a
 
      08-16-2006
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
defining a boolean type Scott C Programming 76 02-17-2010 01:25 PM
Boolean data type? Martin Wells C Programming 15 09-22-2007 10:39 PM
What is a boolean data type? Pep C++ 7 11-30-2006 12:31 PM
Boolean as port type Yaseen Zaidi VHDL 1 04-16-2006 09:39 PM
Re: Cast from type 'DBNull' to type 'Boolean' is not valid Mike Newton ASP .Net 0 07-27-2004 08:41 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57