What are the differences between a static class and a singleton class?

  • A singleton class can be extended, while a static class cannot be extended
  • A singleton class can have multiple instances, while a static class can only have one instance
  • A static class can be extended, while a singleton class cannot be extended
  • A static class can have multiple instances, while a singleton class can only have one instance
A static class can have multiple instances, while a singleton class can only have one instance. A static class is a class that is declared as static and can only access static variables and methods. A singleton class is a class that ensures that only one instance of the class exists in the JVM.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *