๐ŸŒ
W3Schools
w3schools.in โ€บ java โ€บ super-final-keywords
super and final keywords in Java
Instance refers an instance variable ... instance variable and current class (here, clerk) instance variable. Final is a keyword in Java that is used to restrict the user and can be used in many respects....
๐ŸŒ
Slideshare
slideshare.net โ€บ home โ€บ education โ€บ super and final in java
Super and final in java | PPT
It provides examples of using super to refer to parent class variables and methods, and to call parent class constructors. It also gives examples of using final for variables, methods, and classes.
People also ask

What is the Final Keyword in Java?
The final keyword is used as an access modifier to restrict alteration/changes on classes, variables, and methods.
๐ŸŒ
shiksha.com
shiksha.com โ€บ home โ€บ it & software โ€บ it & software articles โ€บ programming articles โ€บ final keyword in java
Final Keyword in Java - Shiksha Online
Where can I use Final Keyword in Java?
Final Keyword with Variables: The final variable cannot be reinitialized with another value. Final Keyword with Methods: A final method cannot be overridden by another method. Final Keyword with Classes: A final class cannot be extended or inherited by another child class.
๐ŸŒ
shiksha.com
shiksha.com โ€บ home โ€บ it & software โ€บ it & software articles โ€บ programming articles โ€บ final keyword in java
Final Keyword in Java - Shiksha Online
What is Final and Static Keyword in Java?
The Final Keyword allows declaring a class, data members, and method to be unalterable i.e. once the variable is assigned the value can't be changed while in static keyword the value is same for every instance.
๐ŸŒ
shiksha.com
shiksha.com โ€บ home โ€บ it & software โ€บ it & software articles โ€บ programming articles โ€บ final keyword in java
Final Keyword in Java - Shiksha Online
๐ŸŒ
Dpgpolytechnic
dpgpolytechnic.com โ€บ downloads โ€บ files โ€บ n5ac73555c4fa2.pdf pdf
Super and final keyword in java Syntax Usage of Superclass Example Output 8
Super and final keyword in java ยท Syntax ยท Usage of Superclass ยท Example ยท Output ยท 8 ยท Class declared as final ยท This will show an error ยท This is because classes declared as final cannot be inherited. Method declared as final ยท Example ยท Variable declared as final ยท
๐ŸŒ
Grow As You Learn
letsunderstandjava.com โ€บ home โ€บ static, this, super & final keyword
Static, this, super & final keyword - Grow As You Learn
August 6, 2024 - Call to super() must be the first statement in a derived class constructor. Eg โ€“ Student() { super(); System.out.println(โ€œconstructorโ€); } To apply restrictions on user access, the final keyword is used.
๐ŸŒ
Medium
medium.com โ€บ @20pa1a0594 โ€บ static-this-super-final-keywords-in-java-1ef55fc4aa62
Static , This , Super , Final keywords in java. | by MANNAM BHARGAVI | Medium
June 11, 2024 - Static , This , Super , Final keywords in java. Static keyword in java: In Java, the static keyword is used to declare members (variables and methods) that belong to the class rather than to any โ€ฆ
๐ŸŒ
Shiksha
shiksha.com โ€บ home โ€บ it & software โ€บ it & software articles โ€บ programming articles โ€บ final keyword in java
Final Keyword in Java - Shiksha Online
August 29, 2023 - It can also improve the performance ... that the method cannot be overridden. ... Classes followed by the final keyword in Java cannot be inherited by any subclass (or child class)....
๐ŸŒ
Javatpoint
javatpoint.com โ€บ final-keyword
Final Keyword In Java
final keyword. The final is a keyword in java. Final can be variable, method, class or parameter. Let's see what are there usage.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ super-keyword
Super Keyword in Java - GeeksforGeeks
The super keyword in Java is a reference variable that is used to refer to the parent class when we are working with objects. You need to know the basics of Inheritance and Polymorphism to understand the Java super keyword.
Published ย  July 23, 2025
Find elsewhere
๐ŸŒ
DataCamp
datacamp.com โ€บ doc โ€บ java โ€บ super
super Keyword in Java: Usage & Examples
The super keyword in Java is used to refer to the immediate parent class object. It is commonly used to access parent class methods and constructors, enabling a subclass to inherit and reuse the functionality of its superclass.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ super-and-this-keywords-in-java
super and this keywords in Java - GeeksforGeeks
June 10, 2024 - The most common use of super keyword is that it eliminates the confusion between the superclasses and subclasses that have methods with same name. super can be used in various contexts as given below: it can be used to refer immediate parent class instance variable ยท it can be used to refer immediate parent class method ยท it can be used to refer immediate parent class constructor. ... // Program to illustrate super keyword // refers super-class instance class Parent { // instance variable int a = 10; // static variable static int b = 20; } class Base extends Parent { void rr() { // referring
๐ŸŒ
BimStudies
bimstudies.com โ€บ home โ€บ object oriented programming with java โ€บ inheritance and interface โ€บ using super and final keywords in java
Using Super And Final Keywords In Java | BimStudies.Com
November 2, 2025 - Using super() ensures that the parent class is initialized properly before the subclass. The final keyword in Java is used to impose restrictions. It can be applied to variables, methods, and classes, ensuring that they cannot be changed or overridden.
Top answer
1 of 16
667

This is a favorite interview question. With this questions, the interviewer tries to find out how well you understand the behavior of objects with respect to constructors, methods, class variables (static variables) and instance variables.
Now a days interviewers are asking another favorite question what is effectively final from java 1.8.
I will explain in the end about this effectively final in java 1.8.

import java.util.ArrayList;
import java.util.List;

class Test {
    private final List foo; // comment-1    
    public Test() {
        foo = new ArrayList(); // comment-2
        foo.add("foo"); // Modification-1   comment-3
    }

    public void setFoo(List foo) {
       //this.foo = foo; Results in compile time error.
    }
}

In the above case, we have defined a constructor for 'Test' and gave it a 'setFoo' method.

About constructor: Constructor can be invoked only one time per object creation by using the new keyword. You cannot invoke constructor multiple times, because constructor are not designed to do so.

About method: A method can be invoked as many times as you want (Even never) and the compiler knows it.

Scenario 1

private final List foo;  // 1

foo is an instance variable. When we create Test class object then the instance variable foo, will be copied inside the object of Test class. If we assign final foo inside the constructor, then the compiler knows that the constructor will be invoked only once, so there is no problem assigning it inside the constructor.

If we assign final foo inside a method, the compiler knows that a method can be called multiple times, which means the value will have to be changed multiple times, which is not allowed for a final variable. So the compiler decides constructor is good choice! You can assign a value to a final variable only one time.

Scenario 2

private static final List foo = new ArrayList();

foo is now a static variable. When we create an instance of Test class, foo will not be copied to the object because foo is static. Now foo is not an independent property of each object. This is a property of Test class. But foo can be seen by multiple objects and if every object of Test which is created by using the new keyword which will ultimately invoke the Test constructor which changes the value of final static variable at the time of multiple object creation (Remember static foo is not copied in every object, but is shared between multiple objects.). To stop this, compiler knows final static cannot be initialized inside constructor and also cannot provide method to assign object to it. So we have to declare and define final List object at the same place at comment-1 in above program.

Scenario 3

t.foo.add("bar"); // Modification-2

Above Modification-2 is from your question. In the above case, you are not changing the first referenced object, but you are adding content inside foo which is allowed. Compiler complains if you try to assign a new ArrayList() to the foo reference variable.
Rule If you have initialized a final variable, then you cannot change it to refer to a different object. (In this case ArrayList)

final classes cannot be subclassed
final methods cannot be overridden. (This method is in superclass)
final methods can override. (Read this in grammatical way. This method is in a subclass)

Now let's see what is effectively final in java 1.8?

public class EffectivelyFinalDemo { //compile code with java 1.8
    public void process() {
        int thisValueIsFinalWithoutFinalKeyword = 10; //variable is effectively final
        
        //to work without final keyword you should not reassign value to above variable like given below 
        thisValueIsFinalWithoutFinalKeyword = getNewValue(); // delete this line when I tell you.
        
        class MethodLocalClass {
            public void innerMethod() {
                //below line is now showing compiler error like give below
                //Local variable thisValueIsFinalWithoutFinalKeyword defined in an enclosing scope must be final or effectively final
                System.out.println(thisValueIsFinalWithoutFinalKeyword); //on this line only final variables are allowed because this is method local class
                // if you want to test effectively final is working without final keyword then delete line which I told you to delete in above program.  
            }
        }
    }

    private int getNewValue() {
        return 0;
    }
}

Above program will throw error in java 1.7 or <1.8 if you do not use final keyword. Effectively final is a part of Method Local Inner classes. I know you would rarely use such effectively final in method local classes, but for interview we have to be prepared.

2 of 16
615

You are always allowed to initialize a final variable. The compiler makes sure that you can do it only once.

Note that calling methods on an object stored in a final variable has nothing to do with the semantics of final. In other words: final is only about the reference itself, and not about the contents of the referenced object.

Java has no concept of object immutability; this is achieved by carefully designing the object, and is a far-from-trivial endeavor.

๐ŸŒ
Javatpoint
javatpoint.com โ€บ super-keyword
Super Keyword in Java
Super keyword in java. The java super keyword is used to refer the immediate parent class object. There are three usage of super. Let's see:
๐ŸŒ
Tpoint Tech
tpointtech.com โ€บ final-keyword
Final Keyword in Java - Tpoint Tech
The final keyword in Java is used to restrict the user. It is also known as a non-access modifier. We can use the final keyword with: Variable Method Class P...
๐ŸŒ
Studocu
studocu.com โ€บ tribhuvan university โ€บ object oriented programming โ€บ question
[Solved] Define super final and this keyword in Java Explain the concept - Object Oriented Programming (OOP-JAVA-IV) - Studocu
March 25, 2025 - Super: The super keyword in Java is used to refer to the immediate parent class of a subclass. It is often used to access the superclass's methods, ... ... AI answers may contain errors. Please double check important information and use responsibly.
๐ŸŒ
DataCamp
datacamp.com โ€บ doc โ€บ java โ€บ final
final Keyword in Java: Usage & Examples
This keyword plays a crucial role in ensuring immutability and preventing inheritance or method overriding. A final variable is a constant; once initialized, its value cannot be changed. ... A final variable must be initialized when it is declared or within a constructor if it is an instance ...
๐ŸŒ
Programiz
programiz.com โ€บ java-programming โ€บ final-keyword
Java final keyword (With examples)
In this tutorial, we will learn about final variables, methods, and classes with examples. In Java, the final keyword is used to denote constants.
๐ŸŒ
Java Training School
javatrainingschool.com โ€บ home โ€บ super keyword
Super Keyword - Java Training School
June 23, 2022 - Whenever an instance of a subclass is created, an instance of parent class is also created implicitly. This can be referred by super reference variable. package com.javatrainingschool; public class Beverage { protected String state = "Liquid"; } package com.javatrainingschool; public class Tea extends Beverage { String state = "Brown Liquid"; public void showBeverageState() { System.out.println("State of tea - " + state); //using super, we are accessing state variable of parent class Beverage System.out.println("State of beverage - " + super.state); } public static void main(String[] args) { Tea tea = new Tea(); tea.showBeverageState(); } }
๐ŸŒ
W3Schools
w3schools.com โ€บ java โ€บ ref_keyword_final.asp
Java final Keyword
Java OOP Java Classes/Objects Java Class Attributes Java Class Methods Java Constructors Java this Keyword Java Modifiers ยท Access Modifiers Non-Access Modifiers Java Encapsulation Java Packages / API Java Inheritance Java Polymorphism Java super Keyword Java Inner Classes Java Abstraction Java Interface Java Anonymous Java Enum