Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
import java.util.Random;
public class Demo {
public static void main(String[] args) {
double[] val = new double[10];
double min = Double.MAX_VALUE;
double max = Double.MIN_VALUE;
System.out.println("Random number array...");
for (int i = 0; i<val.length; i++) {
val[i] = new Random().nextInt(100);
System.out.println(val[i]);
}
for (int i = 0; i<val.length; i++) {
if (val[i] <min)
min = val[i];
if (val[i] >max)
max = val[i];
}
System.out.println("Minimum element = " + min);
System.out.println("Maximum element = " + max);
}
}