Computer Applications
Assertion (A): The boolean data type in Java can have only two possible values: true or false.
Reason (R): Boolean values in Java are stored as integers, with true represented by 1 and false by 0.
Values & Data Types Java
1 Like
Answer
Assertion (A) is true and Reason (R) is false
Explanation
Assertion (A):
True. The
booleandata type in Java can only hold two possible values:trueorfalse.Reason (R):
False. In Java,
booleanvalues are not stored as integers. Java uses a special type to representbooleanvalues directly, without associating them with1or0.
Answered By
1 Like
Related Questions
Consider the following program segment in which the statements are jumbled, choose the correct order of statements to swap two variables using the third variable.
void swap(int a, int b) { a = b; → (1) b = t; → (2) int t = 0; → (3) t = a; → (4) }- (1) (2) (3) (4)
- (3) (4) (1) (2)
- (1) (3) (4) (2)
- (2) (1) (4) (3)
There are 128 set of different characters used in a Java program.
The default value of a boolean variable is:
- False
- 0
- false
- True