What is static in static void main(); ? main() is the method, void the blank return type. How about static?
Title says it all.
Having completed C# basics, I've understood ever code I've typed - except that word static. So what is static in the main method header?
Seth KrogerTreehouse Moderator 56,201 Points
A static method belongs to the class itself and not an instance. You'll sometimes hear them called class methods. The static keyword allows you to call the method from the class itself without having to create an object instance.
This is particularly useful for
main() because this is the very beginning of the program and you've created no objects yet to call instance methods on.
Ari Misha19,207 Points
Hiya there! A static class is basically the same as a non-static class, but there is one difference: a static class cannot be instantiated. In other words, you cannot use the new keyword to create a variable of the class type. Because there is no instance variable, you access the members of a static class by using the class name itself. Hence you cant create objects on it. I hope it helped. (: