Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

what is the size of boolean type  RSS feed

 
suyambu ganesh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please tell me the size of boolean type
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch!

Java doesn't define a specific byte-size for booleans.
 
Muhammad Saifuddin
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chetan Parekh:
Welcome to JavaRanch!

Java doesn't define a specific byte-size for booleans.


According to http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html, the size of boolean is 1 bit(!), not a byte
 
Steve Fahlbusch
Bartender
Posts: 612
7
Mac OS X Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the page you linked:

boolean: The boolean data type has only two possible values: true and false. Use this data type for simple flags that track true/false conditions. This data type represents one bit of information, but its "size" isn't something that's precisely defined.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!