Friday, January 9, 2015

Static

Static means that can be access in an static way (that not need to instanced the class like new ExampleClass)
You can treat static as a global variable which has scope. It basically means if you change it for one object it will be changed for all just like a global variable(limited by scope).

Methods
Java static method program: static methods in Java can be called without creating an object of class. Have you noticed why we write static keyword when defining main it's because program execution begins from main and no object has been created yet. Consider the example below to improve your understanding of static methods.

http://www.programmingsimplified.com/java/source-code/java-static-method-program


No comments:

Post a Comment