Which data type is used to store a single character in Java?
A. char
B. string
C. letter
D. ch
Answer: Option A
Solution(By Examveda Team)
The correct answer is Option A: char.In Java, the char data type is used to store a single character. It can hold any single Unicode character, including letters, digits, and special symbols.
Using char allows you to store individual characters like 'A', '7', '$', etc., whereas String (Option B) is used to store a sequence of characters (a string of characters).
Options C and D are not valid data types in Java.
Related Questions on Data Types and Variables
What is the maximum value that can be stored in a byte variable in Java?
A. 127
B. 255
C. 32767
D. 64
What is the default value of an int variable in Java if it's not explicitly initialized?
A. 0
B. 1
C. -1
D. Null
Which of the following is not a valid identifier for a Java variable?
A. my_var
B. _myVar
C. 3rdVar
D. $var
Join The Discussion