• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Size Of Boolean Value

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Friends,
i am giving interseted to give SCJP2 and i have one problem
hope u will be able to solve.
The problem is what is the actual size of boolean value
as in Roberts and Heller old edition the size specified is 8- bits in new edition they specification is of 1- bits and in khalid mughal the had said that the size is not applicable.
so i am bit confused to decided which is true.

from
Sarang Gurao
sarang_ag@yahoo.com
@rediffmail.com
@hotmail.com
------------------
 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java Language Specification does not tell about the size of the boolean. It says that it can have two values true or false. Normally according to data structure principles a boolean can be represented in 1 bit (0 for false and 1 for true) - Hence many assume that the size is 1 bit.
Now the other way - Java uses 8 bits (a byte) when storing boolean to file. byte value 0 to represent false and 1 to represent true. So most probably Java may be storing the boolean as a byte. Hence I would assume Java uses 8 bit and I will say Robert and Heller is correct.
 
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic