15
Reply

What is the advantage of static class over class ?

Rahul Sharma

Rahul Sharma

8y
351
1
Reply

    You not need to make object of static class

    You not need to make object of static class

    You not need to make object of static class

    You not need to make object of static class

    You not need to make object of static class

    You not need to make object of static class

    You not need to make object of static class

    You not need to make object of static class

    You not need to make object of static class

    You not need to make object of static class

    Static can execute without main

    Static can execute without main

    Static executes before main

    Because static executes before main

     When we have a normal class and its methods being used very frequently in a given app, then it would speed up things if we made this class a static class with static methods. This is because there is always a cost incurred in terms of resource usage ( CPU, memory, time) EVERY TIME a normal class is instantiated, whereas for static class its only a ONE-TIME cost when static constructor is FIRST called. 2. The main advantage of Static Classes come when there is a need to use WebMethod or a webservice, so that the application can call the static method without creating an object.