Method (computer programming): Difference between revisions

Content deleted Content added
m Added links, combined short, disjointed sentences into longer ones (no meaning change)
Tags: Mobile edit Mobile app edit iOS app edit
m linking
Line 96:
 
===Static methods===
Static methods are meant to be relevant to all the instances of a class rather than to any specific instance. They are similar to [[static variablesvariable]]s in that sense. An example would be a static method to sum the values of all the variables of every instance of a class. For example, if there were a <code>Product</code> class it might have a static method to compute the average price of all products.
 
In Java, a commonly used static method is: