jaehee0145 / metacognition

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Metacognition

23.07.29 SAT

final

  • final keyword is used in different contexts. First of all, final is a non-access modifier(비접근 제어자) applicable only to a variable, a method, or a class.
    • Final Variable : To Create constant variable
      • When a variable is declared as final, its value cannot be changed once it has been initialized. This is useful for declaring constants or other values that should not be modified.
    • Final Methods : Prevent Method Overriding
      • When a method is declared as final, it cannot be overridden by a subclass. This is useful for methods that are part of a class's public API and should not be modified by subclasses.
    • Final Classes : Prevent Inheritance
      • When a class is declared as final, it cannot be extended by a subclass. This is useful for classes that are intended to be used as is and should not be modified or extended.

GEEKS - Final Keyword in Java

About


Languages

Language:Java 100.0%