What is the difference between having a class as final and having a class constructor as private
问题 What exactly is the difference between a final class and having a class constructor as private. I know both can't be subclassed(correct me if i am wrong). Is their any difference? 回答1: A final class cannot be extended. It prevents this final class FinalClass { } // and later class ExtendedClass extends FinalClass { // ERROR } This is useful for things like String - you wouldn't want someone to be able to overwrite the logic of String, one of the most commonly used Objects, and be able to, oh