Hello good afternoon. How to declare Boolean data type member as a null in default constructor ? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 3

Hello good afternoon. How to declare Boolean data type member as a null in default constructor ?

Boolean data type

11th Nov 2017, 9:51 AM
raix832
raix832 - avatar
7 Respostas
+ 14
Boolean is a class. However, boolean is a primitive data type.
11th Nov 2017, 10:14 AM
qwerty
qwerty - avatar
+ 12
AĀ primitive type booleanĀ cannot beĀ nullĀ in java. however... A class type Boolean can beĀ null. try this.. btw the reason the output is null is becuase var boo is not affected as boo == null is infact true. Boolean boo = null; if (boo == null) {System.out.println(boo);}
11th Nov 2017, 10:10 AM
D_Stark
D_Stark - avatar
+ 11
private boolean name = null != null;
11th Nov 2017, 10:15 AM
qwerty
qwerty - avatar
+ 2
I tried it in eclipse, you have to put private boolean (variable) = null != null;. How is that possible?
11th Nov 2017, 10:10 AM
raix832
raix832 - avatar
+ 2
what is difference between Boolean and boolean?
11th Nov 2017, 10:12 AM
raix832
raix832 - avatar
+ 2
Boolean (capital B) is a wrapper class boolean (small b) is a data type.
11th Nov 2017, 10:45 AM
Devbrath
Devbrath - avatar
0
thanks guys
13th Nov 2017, 4:08 AM
raix832
raix832 - avatar