voici un bout de code java, j'utilise éclipse comme plateforme de programmation. et comme vous allez le constater il m'affiche une erreur de syntaxe quand j'utilise " nextInt()" j'aimerais savoir pourquoi, quel erreur je commet merci.....
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package essai; public class Alea {// on retente le coup static Alea rand = new Alea(); static int act (int mod) { return Math.abs(Alea.nextInt() % mod + 1);} public static void main(String[] args) { int[] a; a = new int[ act (20)]; System.out.println( "length of a = " + a.length); for(int i = 0; i < a.length; i++) System.out.println( "a[" + i + "] = " + a[i]); // TODO Auto-generated method stub
Partager