Choose the incorrect statement –
2022
Choose the incorrect statement –
- A.
If a method is declared as final, that method cannot be overridden in sub class.
- B.
Finalize() is a method of Java, which is called by garbage collector before removing an object from memory.
- C.
If a class is declared final, it cannot be inherited. If you do so it will give you compile-time error.
- D.
If we declare any variable as final, the value of the variable can be modified in final method.
Attempted by 123 students.
Show answer & explanation
Correct answer: D
He incorrect statement is Option 4. If a variable is declared as final, it becomes a constant. Its value can be assigned only once and cannot be modified later, regardless of whether you are inside a final method or any other part of the code.