+ 3

Java default boolean value?

I thought default value for a boolean was false in java. But I can't understand why boolean b = true?true:false returns true...đŸ˜”

16th Apr 2019, 8:16 AM
Adrien Zettl
Adrien Zettl - avatar
2 Answers
+ 3
there are no value before ini, this return error boolean b; System.out.println(b); Your expression mean // true ? true :false if (true) { return true; else return false; } so you assign true to b
16th Apr 2019, 9:38 AM
zemiak
+ 3
Thanks for your help! I get it now! 👌
18th Apr 2019, 4:07 PM
Adrien Zettl
Adrien Zettl - avatar