5.12.Parameter Types
You are able to use any data type as a parameter in a constructor or method. This encompasses primitive data types, such as integers, floats, and doubles, as demonstrated in the computePayment method, as well as reference data types, including arrays and objects.
The following is an illustration of a method that accepts an array as an argument. The following example illustrates how the method generates a new Polygon object and initializes it with an array of Point objects (assuming that Point is a class that represents an x, y coordinate):
public Polygon polygonFrom(Point[] corners) { // method body goes here }
*Note: A method cannot be passed into another method in the Java programming language. However, it is possible to pass an object into a method and subsequently call the methods of the object.