Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between boolean and Boolean in Java? [duplicate]

Tags:

java

boolean

gwt

I would like to understand the difference between the Boolean and boolean types in Java, specifically as they relate to GWT. I know that methods are not supported but I want more info if it is available.

like image 413
roundcrisis Avatar asked Aug 18 '09 16:08

roundcrisis


People also ask

Is boolean and boolean same?

boolean is a primitive and Boolean is as object wrapper. So boolean, is the type whose values are either true or false while the other is an object.

Should you use boolean or boolean?

8 Answers. Show activity on this post. Yes you can use Boolean / boolean instead. First one is Object and second one is primitive type.

What is the difference between boolean false and false?

false is a primitive and Boolean. FALSE is an object, so they're not really comparable.


1 Answers

It's fairly Simple and the same for GWT and Java:

  • boolean can be yes or no
  • Boolean can be yes, no or NULL.

So unless you need the NULL (like for example your loading the field from the database, and you want NULL to be different to false) then stick to boolean.

like image 70
rustyshelf Avatar answered Sep 22 '22 07:09

rustyshelf