1.

Discuss the final keyword in Java.

Answer»

In Java, the final keyword is USED to restrict the user. The final keyword in Java can be used in a variety of SITUATIONS. The final keyword could be used with a variable, METHOD or class. Once a variable, function, or class has been declared final, it can only be assigned once. That is to SAY,

  • Final variable: If you mark a variable as final, you won't be allowed to change its value (It will be constant).
  • Final method: You can't override a method that has been marked as final.
  • Final class: You can't extend a class that has been marked as final.


Discussion

No Comment Found