boolean nice = rand.nextBoolean();
is declaring and assigning a local variable. You aren’t assigning the field, so it will always have its default value, false
, when you access it with the getter.
Drop the boolean
.
1
solved Random boolean is always false [closed]