What is the difference between constant variables and final variables in java?

Constant is the concept, the property of the variable.

final is the java keyword to declare a constant variable.


As other people pointed out, from a semantic/linguistic point of view the expression constant variable is an oxymoron and, as such, we could argue about its correctness.

Quoting the specification, anyway, we can read

A variable of primitive type […], that is final and initialized with a compile-time constant expression (ยง15.28), is called a constant variable.

I suppose, hence, that we can accept (and consider correct) this binomial for our purpose.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)