Originally posted by Srinivas Kalvala:
Can any one type the difference between the normal object methods and static methods? mostly in problem oriented direction.
Thank you.
I don't know exactly what you really want to know..
But ok let me try..
Difference Between Static Method & Normal Methods >< Instance methods are associated with an object and use the instance variables of that object. This is the default.
>< Static methods use no instance variables of any object of the class they are defined in. If you define a method to be static, you will be given a rude message by the compiler if you try to access any instance variables. You can access static variables, but except for constants, this is unusual. Static methods typically take all they data from parameters and compute something from those parameters, with no reference to variables. This is typical of methods which do some kind of generic calculation. A good example of this are the many utility methods in the predefined Math class.
With Normal Method if you need to invoke them then you have to create an Object of Class and then need to call the method with that Object.
But in Case of
Static Methods you may directly call method with refernce of Class Directly.
This is the biggest use of Static methods.
There are so many
built-in API's in so many classes which are declared as static so that we may directly call without instantiating the Class.
Hope this helps you..
If still any concern then revert me with exact concerns...