Reputation: 1
For example, if I have a Stage with Buttons and Panes, should they be declared as static final by default?
Upvotes: 0
Views: 101
Reputation: 1917
Static variables mean they are in the application scope. So, all objects of the containing class will have the same value . In other words, static variables belong to class level instead of object level. So, if there are some variables which fulfill this criteria while you are coding, make them static.
Final variables are the ones whose value will not change once initialized. So, if there is any variable whose value is not going to change through the application then make it as final.
Example, constants in a Java file are defined as static final. There can be other cases too.
Upvotes: 2