This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes memory spacereserved by  boolean data type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "memory spacereserved by  boolean data type" Watch "memory spacereserved by  boolean data type" New topic
Author

memory spacereserved by boolean data type

Jalees Ahmed
Greenhorn

Joined: Jul 10, 2008
Posts: 3
Could you please tell me the size reserved by boolean variable in the memory.
Like int take 4 bytes,char take 2 bytes,etc.
Thanks in advance....
Eric Daly
Ranch Hand

Joined: Jul 11, 2006
Posts: 143
Taken from Sun's Java Tutorial:

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.


Studying for SCJP 6
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Its JVM specific. Not defined


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: memory spacereserved by boolean data type
 
Similar Threads
question about boolean data type
what is bit depth of a boolean ?
object references and memory space requirements
Size of bool variable
object size