User-defined methods are procedures that can be defined by specifying a return type, name, parameter list and code block.
Pattern:
where:returnType methodName(parameterDeclarations) { statements }
void
if the method does not return a value;
As an example, consider the the following definition of a
computeDistance()
method. This method receives from its calling program the x-y coordinates of two points
and computes and returns the Euclidean distance between those two points.
Note that Processing already defines a distance method , but defining one ourselves serves as a good illustration.