Methods:
public static int getMax(int[] a)
andpublic static int getMin(int[] a)
have int[]
as their input parameter,
but they are later called without any parameters: arr.getMax();
and arr.getMin();
.
This is the cause of the error you are getting from the compiler.
EDIT:
You probably want to modify your methods not to be static and not to have any input parameters (the array a
would be used directly from the object and not passed to the method), so you can use methods on the object of the class like this: arr.getMax();
.
To do so change the code in the following way:
public static int getMax(int[] a)
–>public long getMax()
public static int getMin(int[] a)
–>public long getMin()
* Note: The return type of getMax
and getMin
methods is changed from int
to long
, because long
is the type of array in the HighArray
class.
1
solved Min/Max Values of an Array