• Home
  • Recent Q&A
  • Java
  • Cloud
  • JavaScript
  • Python
  • SQL
  • PHP
  • HTML
  • C++
  • Data Science
  • DBMS
  • Devops
  • Hadoop
  • Machine Learning
in Design Patterns by
Q:

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

1 Answer

0 votes
by
  • A static class can not be a top level class and can not implement interfaces where a singleton class can.

  • All members of a static class are static but for a Singleton class it is not a requirement.

  • A static class get initialized when it is loaded so it can not be lazily loaded where a singleton class can be lazily loaded.

  • A static class object is stored in stack whereas singlton class object is stored in heap memory space.

Related questions

0 votes
asked Oct 16, 2019 in Design Patterns by DavidAnderson
0 votes
asked Oct 16, 2019 in Design Patterns by DavidAnderson
...