mobile ads

Monday 25 November 2013

Why we use Static Keyword?

The static keyword defines, that the class or property or method we declare as static does not require a previous instance of an object. In the other hand, a static method for example cannot use any instance method / instance property of the own object.

Also static defined things will be optimized by the compiler, for example that a static object is only written once in the memory and everything accesses to the same object. When we use static keyword it means there is no need to create an instance of object . Static class including a static method can called by class name. Static class can have only static methods.

0 comments:

Post a Comment