Writing final classes Declaring an entire class final is allowed in java.If a class is declared as final can’t be subclassed. It is a very useful for immutable classes such as String class in java. final class FinalClass{ public void methodOne( double var){ //Body of the method } } Writing final methods You can use