KnowledgeBoat Logo
|

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;
  • final ensures that the value of x cannot be changed after initialization.
  • This makes x a constant variable.

Answered By

3 Likes


Related Questions