Difference between final variables vs static final variables
java
Solution
But even if i declare a variable only final, then it remains the same for all the objects as i need to initialize them in the program itself and not at the run time.
No, non-static final members can be initialized in the constructor. They cannot be re-assigned after that.
Problem
I was just studying about final data members and i thought what would be the difference final variables vs static final variables ?? I understand that a field that is both static and final has only one piece of storage, and final variable will have storages associated with every instance. But even if i declare a variable only final, then it remains the same for all the objects as i need to initialize them in the program itself and not at the run time. So, basically there is no difference between the two except for the memory related issue ??