Math.min.apply(arr); cannot find symbol min
Bonjour,
je ne comprends pas pourquoi ce programme ne fonctionne pas ????
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| package tableau.random;
import java.util.*;
public class TableauRandom {
public static void main(String[] args) {
int totalelem=10,minimum;
int tableauEntier[] = new int[totalelem];
for (int i=0 ; i <totalelem ; i++) {
tableauEntier[i] = (int)(Math.random()*100);
System.out.print(" "+tableauEntier[i]);
}
minimum=Math.min.apply(tableauEntier);
System.out.println(" ");
System.out.println("Le nombre minimum compris dans le tableau est : "+minimum);
}
} |
Voici le message d'erreur :
Code:
1 2 3 4 5
| Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: java.lang.Math.min.apply
0 71 21 20 32 81 18 38 20 28 at tableau.random.TableauRandom.main(TableauRandom.java:21)
C:\Users\corac\AppData\Local\NetBeans\Cache\10.0\executor-snippets\run.xml:111: The following error occurred while executing this line:
C:\Users\corac\AppData\Local\NetBeans\Cache\10.0\executor-snippets\run.xml:68: Java returned: 1
BUILD FAILED (total time: 0 seconds) |
et sur le point d'exclamation rouge en marge : cannot find symbol
symbol : variable min
location : class Math
Quelqu'un peut m'aider ?
Merci