Methods

A method is loosely something which an object or class can do in object oriented programming.

Methods must be understood in context by looking at objects, methods & classes together.

Note that there are two types of methods in Java:

Static methods, which are like mathematical functions. Math.abs(x) for instance is a static method which will return the absolute value of the variable x.

Instance methods are associated with objects. An example of a program using an instance method is the triangle drawing example.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License