Q22
Which data type is used to represent integer values in Java?
A.
int
AnswerB.
float
C.
boolean
D.
char
Answer: Option A
Solution
Answer: Option A
Solution:
The correct answer is Option A: int.In Java, the int data type is used to represent integer values (whole numbers) without decimal points.
Here's the breakdown:
Option A: int - This is the correct data type for representing integer values in Java.
Option B: float - The float data type is used for representing numbers with decimal points, not integers.
Option C: boolean - The boolean data type is used to represent true or false values, not integers.
Option D: char - The char data type is used to represent single characters, not integers.
So, in Java, the data type used to represent integer values is int.