What is the keyword used to declare a constant value in Java?
A. constant
B. const
C. final
D. static
Answer: Option C
Solution(By Examveda Team)
The correct answer is Option C: final.In Java, the keyword used to declare a constant value is final.
Here's the breakdown:
Option A: constant - There is no constant keyword for declaring constants in Java.
Option B: const - There is no const keyword for declaring constants in Java. The const keyword is not used for this purpose in Java.
Option C: final - This is the correct keyword for declaring a constant value in Java. When you declare a variable as final, it means its value cannot be changed after initialization, making it a constant.
Option D: static - The static keyword is used to declare static variables and methods but not specifically for declaring constants.
So, the keyword used to declare a constant value in Java is final.
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