Anant Kulkarni
What is the difference between Singleton and Static class
  • Akash Varshney
    Oct, 2015 10

    Main difference between in Singleton and Static . Singleton will be available when its needed in the program. you dont need to allocate memory if its not required at the starting time of application. Static will be initialized at the beginning time it self. and it will be available at the program.

    • 2
  • Manas Mohapatra
    Jul, 2015 14

    Singleton: 1. Singleton class contains both static and non-static members 2. You can create instance of Singleton class. 3. You can implement inheritance. 4. You can clone a singleton class object. 5. Singleton class object creates in Heap memory. Static Class: 1. Static class contains only static members. 2. You can't create instance of Static class. 3. Once you declare a class as static you can't implement inheritance. 4. You can't clone static class object. 5. Static class object creates in stack memory.

    • 2
  • Sudheshwer  Rai
    Jun, 2015 26

    Singleton Class : We use this when we need to create only a single instance of the class.Static Class : Static Class can have static constructor but it can't have instance constructor. It calls automatically when program loads in memory.

    • 2
  • Bhuvanesh Mohankumar
    May, 2016 5

    Singleton: single instance can be created at any point of time.Static: No instance of the class is created.

    • 1
  • Prakash Tripathi
    Jul, 2015 14

    Please have a look at below article, it may help. http://www.c-sharpcorner.com/uploadfile/19b1bd/design-patterns-simplified-part-2-singleton/

    • 1
  • Sujeet Suman
    Jun, 2015 17

    Singleton Class: you can create one instance of the object and reuse it. Singleton instance is created for the first time when the user requested. singleton class can have constructor.Static Class: You can not create the instance of static class. are loaded automatically by the .NET Framework common language runtime (CLR) when the program or namespace containing the class is loaded. Static Class class cannot have constructor.

    • 1
  • Mohammad Ilyas
    Jun, 2017 14

    Singleton class can be inherited from another class. Static class cannot be inherited.

    • 0
  • Maruthi Palllamalli
    Mar, 2016 9

    You cannot apply new keyword to both static class and singleton classes. But CLR will load this static class, you can only load singleton class.

    • 0
  • Munesh Sharma
    Jun, 2015 16

    http://javarevisited.blogspot.in/2013/03/difference-between-singleton-pattern-vs-static-class-java.html

    • 0
  • Anant Kulkarni
    May, 2015 21

    The Singleton class should be used where an instance of an object is required to be passed to some method. Since static class object cannot be created, we wont be able to pass it around as an instance.

    • 0