Swiftorial Logo
Home
Swift Lessons
AI Tools
Learn More
Career
Resources

Java FAQ: Top Questions

18. What is the final keyword in Java?

The final keyword in Java restricts modification, applied to variables, methods, or classes.

  • Final Variable: Cannot be reassigned after initialization (constant).
  • Final Method: Cannot be overridden by subclasses.
  • Final Class: Cannot be extended (e.g., String is final).
  • Blank Final: A final variable initialized only in a constructor.