tags:

views:

104

answers:

2

what is the difference among bool, boolean and Boolean in Java/android.

+3  A: 

bool does not seem to exist, at least I can't find references to it.

boolean is a primitive boolean type, not an object.

Boolean is the wrapper object for a boolean.

Thomas Lötzer
+5  A: 

boolean is a java primitive type. It only accepts true or false (which are declared constants in java).

Boolean is a Serializable wrapper of boolean primitive type. From the JDK....

The Boolean class wraps a value of the primitive type boolean in an object. An object of type Boolean contains a single field whose type is boolean.

bool doesn't exist in java, but it does in Android as R.bool.

The Elite Gentleman
So what is Android's R.bool for?
bruceboughton
I've heard of `android.R` but I have no clue what it's uses are...maybe it's for the R programming language.
The Elite Gentleman
Ah! `R.bool` is a "resource type" in Android. God only knows why Google decided to ignore Java identifier conventions with the name.
Stephen C