What is the effect of declaring a class as `final` in Java?

Java Associate Hard

Java Associate — Hard

What is the effect of declaring a class as `final` in Java?

Key points

  • The `final` keyword in Java is used to restrict inheritance.
  • By marking a class as `final`, you are essentially saying that it is complete and cannot be extended.
  • This is different from preventing instantiation or making all methods static.

Ready to go further?

Related questions