java - how to fix an error when calling a method? -
I must call the method that takes an array of parameters and moves the minimum value in front of the list. I am getting this line an error:
System.out.printf ("display number \ n", myList.minInteger); Here's the code:
import java.util. *; Public square MinToFront {public static zero main (string [] args) {MinToFront myList = new MinToFront (); ArrayList & LT; Integer & gt; List = New Arrestist & lt; Integer & gt; (); List.add (3); List.add (8); List.add (92); List.add (4); List.add (2); List.add (17); List.add (9); myList.minToFront (list); System.out.printf ("Display Number \ n", myList.minInteger); } // The main public static zero minToFront (ArrayList & lt; integer & gt; minInteger) end {int result = 0; int min = minInteger.get (0); (Int (= minInteger.get (i) & lt; min) {min = minInteger.get (i); Results = minute; }} MinInteger.add (0, minInteger.remove (result));} // method end // class
main () . Finally, you should put the parentheses at the end of a method while calling it.
This is your The code is correct:
public static zero minToFront (ArrayList & lt; integer & gt; minInteger) {int result = 0; int min = minInteger.get (0); (int i = 0; For i & lt; minInteger.size (); i ++) (if (minInteger.get (i) & lt; min) {min = minInteger.get (i); Results = minute;}} minInteger .add (0, result); minInteger.remove (result);} // end of method // // end of class
Comments
Post a Comment