The first time to learn Java, the following case only discusses the input three number of sequential order size, the idea is to first enter a number and to, split open, through the nextline to get the string just entered, and by splitting up a string array, Converts a string array to an int array , Arr[i]=integer.parseint (S[i]), using a for array; then, according to the initial value assigned to Max,min,mid, the output of its minimum, median, and maximum values are judged respectively.
Import Java.util.scanner;class bigger {public static void main (string[] args) {Scanner scan=new Scanner (system.in); String A=scan.nextline (); String[] S=a.split (","); int[] arr=new int[s.length];for (int i=0;i<s.length;i++) {arr[i]=integer.parseint (s[i]);} int max=arr[0];int min=arr[0];int mid=arr[0];for (int i=0;i<arr.length; i++) {if (Max<=arr[i]) {max=arr[i];} else if (min>=arr.length) {min=arr[i];} Else{mid=arr[i];}} System.out.println (min+ " " +mid+ "" +max);}}
Java Learning Digital Sorting order