We will cover following points in this article
4. Methods make application maintenance easier.
<accessmodifiers> <return-type> <method-name> (<parameters>)
<access modifiers> à public, private, protected, internal, protected internal
<return-type> à void or any valid data type
<method-name> à can be any meaningful name except reserved keyword
<parameters> à are optional
Static vs Instance methods
1. Static methods are declared using static modifier. Static methods are invoked using the class name.
2. Instance methods are declared without using the static modifier. Instance methods are invoked using the instance of the class.
3. A static method cannot access non-static class level members.
4. Instance methods can access static fields.
5. If a method is declared as static then only one definition of the static method exists in the memory. Multiple instances/objects of a single class can invoke only one definition of the static methods but each objects will have its own separate instance methods.