I know this is a very basic question. Also second part does not fit well in OO world. However when I googled about the answers, I got many results and some of them are conflicting so thought of clearing all things. Also I want to know the difference in terms of the memory allocation for the methods. Thanks in advance.
Share
The reason we use classes in OO programming is so that we can encapsulate state. A static method will (at best) only maintain a single state. An instantiated object can maintain a state that is unique to that instance, and separate instances have no affect on eachother (unless explicitly implemented).
For example, imagine a simple class that maintains a count of how many times a method was called, and exposes that count through a property. Using only static members, you can only ever have one count. Using instance members, you can create multiple objects and each will maintain its own distinct count.
If a member doesn’t have any state at all (that is, a method uses no variables that aren’t declared within or passed as parameters to that method) then making it static is a good idea.