Multiple choice technology programming languages

The legal values for a boolean in java are choose all that applies

  1. 1,0

  2. TRUE,FALSE

  3. true , false , TRUE,FALSE

  4. true , false

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

In Java, the boolean primitive type has exactly two literal values: true and false, both strictly in lowercase. Java is case-sensitive, so TRUE and FALSE are not valid boolean literals (they are not defined keywords). Option C incorrectly includes uppercase variants, while Option A suggests numeric values which are completely invalid for boolean types.

AI explanation

In Java, the boolean literals are strictly the lowercase keywords true and false — Java has no implicit conversion from integers (1/0) to boolean, and it is case-sensitive, so TRUE/FALSE are not valid boolean literals (they'd just be undefined identifiers). Only true and false are legal, which is why that is the sole correct option.