You can have both final instance and final static variables. final statics are more common. When you know the value of a constant at compile time you might as well make it static. It takes up less room, just one copy per class instead of one copy per object. It is also faster to access a static constant than an instance constant. However, if you don’t know the value of the constant until instantiation time, you have to make it an instance constant.
![]() |
and suggestions to improve this page to Roedy Green : | ||
| Canadian Mind Products | |||
| mindprod.com IP:[65.110.21.43] | |||
| Your face IP:[38.103.63.16] | The information on this page is for non-military use only. | ||
| You are visitor number 99,158. | Military use includes use by defence contractors. | ||
| You can get a fresh copy of this page from: | or possibly from your local J: drive (Java virtual drive/Mindprod website mirror) | ||
| http://mindprod.com/jgloss/final.html | J:\mindprod\jgloss\final.html | ||