+ 10

What different between Boolean and boolean in Java?

14th Dec 2016, 5:22 PM
Mahmood Ali
Mahmood Ali - avatar
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.
14th Dec 2016, 5:27 PM
Emil Voica
Emil Voica - avatar
+ 4
thank you ..
14th Dec 2016, 6:31 PM
Mahmood Ali
Mahmood Ali - avatar
+ 4
you are most welcome
14th Dec 2016, 6:31 PM
Emil Voica
Emil Voica - avatar
+ 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?
15th Dec 2016, 8:16 PM
Anderz Lindberg
Anderz Lindberg - avatar
+ 3
boolean true,false;Boolean true,false,null
16th Dec 2016, 12:24 AM
RamMin
RamMin - avatar
+ 1
its only true and false,there's no major differences :)
15th Dec 2016, 4:29 PM
Aurum Titan
Aurum Titan - avatar
+ 1
their is no difference👷
15th Dec 2016, 11:54 PM
Oliver Hunt
Oliver Hunt - avatar
+ 1
Boolean may be used for tristate logic. Is capable of storing both true and false plus the null value too.
16th Dec 2016, 7:43 AM
Noushad Ali
Noushad Ali - avatar
0
everything in java is essentially an object
15th Dec 2016, 4:06 PM
Anderz Lindberg
Anderz Lindberg - avatar
- 7
Boolean is a variable declaration and boolean its a type that value suporte numbers.
15th Dec 2016, 3:08 PM
Yanka Santos
Yanka Santos - avatar