Vidyalelo
Java Programming · Q6

Data Types and Variables

Programming · Java Programming · question 6

Q6

In Java, which data type is used to represent true or false values?

A.
boolean
Answer
B.
bit
C.
logic
D.
binary

Answer: Option A

Solution

Answer: Option A
Solution:
The correct answer is Option A: boolean.

In Java, the boolean data type is used to represent true or false values.

Here's the breakdown:

Option A: boolean - This is the correct data type for representing true or false values in Java.

Option B: bit - While bits are used in computer systems to represent binary values (0 or 1), there is no specific bit data type in Java for representing boolean values.

Option C: logic - There is no logic data type in Java for representing boolean values.

Option D: binary - This term refers to binary values, but it is not a data type used to represent boolean values in Java.

So, the correct choice for representing true or false values in Java is boolean.