How can you create class methods that cannot be overridden by subclasses?

  • By defining the method inside the constructor.
  • By making the method static.
  • By marking the method as final.
  • By using the const keyword.
In many object-oriented programming languages, including JavaScript and Java, you can create methods that cannot be overridden by subclasses by marking them as final. This keyword indicates that the method is the final implementation and cannot be further overridden.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *