Originally Posted by
Leprechaun
Here's my understanding about the difference between static and nonstatic methods...
Static methods will always be the same for every object they are in. So lets say you have a Circle class, you could have a static method called printAreaFormula().. which would always print: "3.14 * r * r" (or similar).
Nonstatic means that the object can be different. For the circle class you could have a circle object with a radius of 3 and one with a radius of 4. So if you have a printRadius() function the outcome would depend on the object.
The main method is static because it always does the same thing (which can vary with paramteres and user input)...
I see your point here... but why are we declaring it as a static method ???
In your example we still can passs values to the parameters even if we dont declare the method (static). I read more than a Java book and they all mention that "Static means that you dont have to create an instance or an object of that static method in order to call it or use it"... and I still dont see what does it mean.. ??
And this leads me to another question... is it possible to change static methods or variables ???
Thanks alot for the example.