
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference Between Static and Final in Java
In this post, we will understand the difference between ‘static’ and ‘final’ keywords in Java.
Static
It can be applied to nested static class, variables, methods and block.
It is not required to initialize the static variable when it is declared.
This variable can be re-initialized.
It can access the static members of the class only.
It can be called only by other static methods.
Objects of static class can’t be created.
Static class can only contain static members.
It is used to initialize the static variables.
Final
It is a keyword.
It is used to apply restrictions on classes, methods and variables.
It can’t be inherited.
It can’t be overridden.
Final methods can’t be inherited by any class.
It is needed to initialize the final variable when it is being declared.
Its value, once declared, can’t be changed or re-initialized.