+ 10
What different between Boolean and boolean in Java?
10 odpowiedzi
+ 22
smart question!
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.
If you wanted to convert a string to a boolean you could try Boolean.valueOf("true"). Because Boolean can be null, it can be used for lazy loading. As far as GWT, they are the same in GWT as there are in java.
On Boolean, you will get more methods which will be useful. Second one (boolean) is cheap considering memory.
+ 4
thank you ..
+ 4
you are most welcome
+ 4
To whoever minus voted my answer: are you sure you minused me for the right reasons? Just because a language is supposed to be used in a particular way, like we have here (I know the wrapper classes). But if value typed were not objects themselves, then how can java say that a particular value type of being of an exact defined size (normally it is the architecture that sets sizes for the bytes, words etc)? Java MUST make an object out of it in order typ garantuee an exakt size othet than HW limits. Or am I wrong?
+ 3
boolean true,false;Boolean true,false,null
+ 1
its only true and false,there's no major differences :)
+ 1
their is no difference👷
+ 1
Boolean may be used for tristate logic. Is capable of storing both true and false plus the null value too.
0
everything in java is essentially an object
- 7
Boolean is a variable declaration and boolean its a type that value suporte numbers.