Computer Applications
Which of the following is a valid constant declaration in Java?
Values & Data Types Java
2 Likes
Answer
final int x = 10;
Reason — In Java, constants are declared using the final keyword. The correct way is:
final int x = 10;
finalensures that the value ofxcannot be changed after initialization.- This makes
xa constant variable.
Answered By
3 Likes