Vidyalelo
Java Programming · Q14

Data Types and Variables

Programming · Java Programming · question 14

Q14

What is the minimum value that can be stored in a char variable in Java?

A.
0
Answer
B.
-128
C.
-32768
D.
'a'

Answer: Option A

Solution

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

In Java, a char variable is a 16-bit unsigned data type that can represent Unicode characters. The minimum value that can be stored in a char variable is 0, which corresponds to the Unicode character with the code point of zero.

Here's the breakdown:

Option A: 0 - This is the correct minimum value that can be stored in a char variable in Java. It represents the Unicode character with the code point of zero.

Option B: -128 - This value is not applicable to char variables in Java. It's more relevant to signed integer types.

Option C: -32768 - This value is not applicable to char variables. It's a range associated with short or int data types in Java.

Option D: 'a' - This represents the character 'a', not a numeric value, and it is not the minimum value that can be stored in a char variable.

So, the correct minimum value that can be stored in a char variable in Java is 0