Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • And if I did create a subclass of the Math class, I sure would like to be able to redefine what Absolute value means. Since subclassing implies you want to modify how the class works, "final" prevents subclassing, not modification as such. Why would you want to prevent that? Commented Feb 8, 2009 at 20:44
  • @Pies - well, with the given example, Absolute value has one meaning and it should not be changed, even if you want it to. Commented Feb 8, 2009 at 20:48
  • What you're saying is that "final" means that the particular class makes no sense to extend? Commented Feb 8, 2009 at 20:51
  • Actually, Math is final because it's a static utility class - it has no instance methods or properties. It's common to make such a class final to lock it down. Commented Feb 8, 2009 at 22:04
  • It also enforces using Math.xxx, instead of math=new Math ... math.xxx Commented Feb 8, 2009 at 22:04

lang-php