Go Back   Velocity Reviews > Newsgroups > Java
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

Java - Size of boolean type

 
Thread Tools Search this Thread
Old 08-16-2006, 06:59 AM   #1
Default Size of boolean type


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
  Reply With Quote
Old 08-16-2006, 07:19 AM   #2
Mike Schilling
 
Posts: n/a
Default Re: Size of boolean type
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.





Mike Schilling
  Reply With Quote
Old 08-16-2006, 07:22 AM   #3
Srinivasa
 
Posts: n/a
Default Re: Size of boolean type
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.




Srinivasa
  Reply With Quote
Old 08-16-2006, 04:03 PM   #4
maruthisoft@gmail.com
 
Posts: n/a
Default Re: Size of boolean type
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.




maruthisoft@gmail.com
  Reply With Quote
Old 08-16-2006, 04:19 PM   #5
Mike Schilling
 
Posts: n/a
Default Re: Size of boolean type
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?




Mike Schilling
  Reply With Quote
Old 08-16-2006, 04:39 PM   #6
Patricia Shanahan
 
Posts: n/a
Default Re: Size of boolean type
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


Patricia Shanahan
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

vB 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
Eclipse - Axis2 - Java Webservices Error amanjsingh Software 1 10-09-2007 09:03 AM
Required permissions cannot be acquired. Mukesh Doot Software 1 04-18-2007 10:58 PM
Need help on Modelsim VHDL syntax? ASAP:) kaji General Help Related Topics 0 03-14-2007 10:43 PM
Need help on a Modelsim VHDL Syntax? ASAP:) kaji Software 0 03-14-2007 10:43 PM
Need Help on a Modelsim VHDL Syntax....ASAP:) kaji Hardware 0 03-14-2007 10:41 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

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