Raju Sidda Raju Sidda - 1 month ago 11
Java Question

java singleton class vs final class

can anybody explain me clearly on java singleton design pattern class vs java final class. can we use final class instead of using singleton class, for final class we can create the instance of the class and use the methods in that, but not overriding properties, if that methods are static in final class we can just call the methods like ClassName.getMethod, why we go for singleton instead of final class.


A final class is one which cannot be extended. Singleton is a single instance of a class which is different from final class. You can have any number of instances in a final class. Best example of a final class is String.