Don’t want somewhere in the program to change class fields then make is final
don’t want to allow a class to be inherited then make the class final
want to allow another class to inherit method of a class but don’t allow them to override it then make the method final.
Q) False statement about final method in java
Value of final variable cannot be changed once initialized.
Final method is inherited but we cannot override it
If you make a class final then you cannot extend the class
Constructor can be declared as final.
final variable act as a const, hence cannot be changed. final method we make to stop another class to override it. Class is made final to restrict, so, it cannot be inherited. Constructor cannot be final as they cannot be inherited.
Q) Super keyword in java is used to
Refer immediate parent class instance variables.
Invoke immediate parent class methods.
Invoke immediate parent class constructor.
Q) True statement about extending a class in java is
A class can extends only one another class
A class can extends multiple classes.
A class can extends multiple interfaces.
A class can extends only one another class and cannot extend multiple classes as java does not support multiple inheritance for classes.
A class does not extends interfaces but implement them, hence, answer C is incorrect. However, multiple inheritance in java is supported for interfaces. Means. you can implement multiple inheritance using interface.