
Functions in Java • 149
Explanation: In the expression m = max (a, max (b, c)) the fi rst max (b, c) is called and when
this returns, the call max (b, c) is replaced by the maximum of two, either b or c, say t (assume). Then
again, function max is called which returns max of a and t. Note how the maximum of three numbers is
calculated with a function which fi nds maximum of two numbers only.
On the similar basis, max of 4 numbers can be calculated by writing the following:
m = max (max (a, b), max (c, d));
6.5 RECURSION
Recursion is a programming technique in which a function calls itself for a number of times until a particular
condition ...