- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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.
- Related Articles
- Static and non static blank final variables in Java
- Final static variables in Java
- Difference between constants and final variables in Java?
- Difference Between Final, Finally and Finalize in Java
- Difference between Static binding and dynamic binding in Java
- Initializer for final static field in Java
- Difference between default and static interface method in Java 8.
- Explain the difference between static and dynamic binding in Java.
- What is the difference between final, finally and finalize() in Java?
- What is the difference between static classes and non-static inner classes in Java?
- What is static blank final variable in Java?
- Interface variables are static and final by default in Java, Why?
- What is blank final variable? What are Static blank final variables in Java?
- Assigning values to static final variables in java\n
- Difference Between Static and Const in JavaScript
