Skip to content
Talk about final keyword in Java?
- Final keyword in Java is used to restrict user action
- With final keywords, we have final variable, final method and final class
- Final variable: In Java, a final variable is declared with final keyword and then you won’t be able to change that variable. Or in a simple word, it’s constant
- Final method: A final method is declared with final keyword so that subclass will not be able to overridde that method
- Final class: when a class is declared with final keyword, it can not be inherited