While checking the source code of Java's BigDecimal
class, I was surprised that it was not declared as a final class
:
Class BigDecimal
public class BigDecimal extends Number implements Comparable<BigDecimal>
Immutable, arbitrary-precision signed decimal numbers.
(from the Oracle Docs)
Is there a specific reason for this or did the developers just forget to add that keyword? Is it a good practice to not declare immutable classes as final?
The same goes for BigInteger
, but not for String
which is declared as final.