Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Java program, declare an array whose length is defined as n (n is equal to 10 in this question), and find the largest number and the smallest number from the array.
Java program, declare an array whose length is defined as n (n is equal to 10 in this question), and find the largest number and the smallest number from the array.
//The easiest way

Import? Java . util . *;

Public? Class? Max_MinDemo{

Public? Static electricity Invalid? main(String[]? args){

int[]? arr? =? { 12,3,56, 128,58,98};

Array. sort (arr);

system . out . println(" Maximum:"+arr[arr . length- 1]);

System.out.println ("minimum value:"+arr [0]);

}

}