What is the ratio of processing power used to analyze this:
boolean: true != false
versus this:
int: 1 != 0
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
They are effectively the same cost, but the real answer is that it is dependent on the virtual machine, etc. If the JVM packs booleans (as this question answer might suggest for boolean arrays: What is the size of a boolean variable in Java?) then accessing a boolean might require some additional arithmetic to mask off the important bit / byte. However, it will usually be the same cost.