I know a java a little bit , have used final and static multiple times , But I am quiet confused here : What is the basic difference between a final class A and a static class B. I know these keywords . Just could not imagine the use of final in a class declaration.
Final class : In simple words is a class that cannot be extended . - It is generally useful for writing classes to be immutable e.g. String class that is generally done for security
Static class : Static classes can only be used in case of nested classes. - Nested static class doesn't need reference of Outer class but non static nested class needs it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With