Home » Interview » Technology

How to define a constant variable in Java?

Correct Answer: The variable should be declared as static and final So only one copy of the variable exists for all instances of the class and the value can't be changed also static final int PI = 214; is an example for constant

← Previous Question Next Question→

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion