difference between final and static keyword in java code example
Example 1: difference between static and final in java
The two really aren't similar.
"STATIC" fields are fields that do not
belong to any particular instance of a class.
and there is only one copy of the variable in memory
shared by all instances of the class.
On the other hand
"FINAL" The final keyword just means the value
can't be changed. Without final, any object can
change the value of the variable
Example 2: final vs static keyword in java
The two really aren't similar.
"STATIC" fields are fields that do not
belong to any particular instance of a class.
and there is only one copy of the variable in memory
shared by all instances of the class.
On the other hand
"FINAL" The final keyword just means the value
can't be changed. Without final, any object can
change the value of the variable