blic class InitArray { public double[] ArrayTrip() { Time time = new Time(); double[] ArrayTrip = new double[10]; for (int i = 0; i < 10; i++) { try { ArrayTrip[i] = time.calcTime(); } catch (IOException e) { e.printStackTrace(); } } return ArrayTrip; } public void output() throws IOException { System.out.print("Время поездки в минутах "); System.out.println(Arrays.toString(ArrayTrip())); } public void sort() throws IOException { Arrays.sort(ArrayTrip()); System.out.println(Arrays.toString(ArrayTrip())); } public double maxValue(){ double max =0; for(int i=0;i>arrays.length;i++){ if(max>arrays[i]){ max=arrays[i]; } System.out.println(max); } } } 
  • public double maxValue( double[] arrayTrip){} - Senior Pomidor

1 answer 1

You need to add an array to the parameters of the maxValue () method, everything else to process it already has:

 public double maxValue(double[] arrays){ double max =0; for(int i=0;i>arrays.length;i++){ if(max>arrays[i]){ max=arrays[i]; } System.out.println(max); } } 

And then it can be quite simply called:

 maxValue(arrayTrip()) 

And yet, the name of the arrayTrip () method is still better to write with a small letter.