0

What does static mean when defining methods? C# (or java I guess)

I am in the process of defining and understanding each word in each of my programs, and I am stuck on what static means exactly and its functionality. Any and all help would be greatly appreciated!

9th Oct 2019, 5:52 PM
Nick Mattinson
Nick Mattinson - avatar
1 Answer
+ 1
Static method is a method which won't be shared with class objects. The methods can be divided into 2 classes: static methods (class method) non-static methods (object method) If a method was not declared as static it would be declared as non-static by default, non-static method are able to get called by class objects. We don't want some methods to get called by class objects. Even though we didn't call non-static methods by objects, declaring the methods as non-static would waste recourses for methods to be prepared to get called by class objects, which won't happen. If static keyword still seems confusing, you don't need to much care about it until you get into OOP, just use it like it is used in examples and you should do well.
9th Oct 2019, 6:31 PM
Seb TheS
Seb TheS - avatar