Bonjour,

Je dois réaliser un jeu de l'oie.
Mais lorsque je veux initialiser toute mes cellules j'ai un nullPointerException :
Code Java :
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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
protected void initBoard(){
		System.out.println("init");
		RegularCell reg ;
		for(int i=0; i<=80; i++){
			System.out.println("cell "+ i+ " créée");
			reg = new RegularCell(i);
			theCells[i]=  reg; //nullpointerException
		}
		int n= this.twoDicesThrow();
		GooseCell oie1 = new GooseCell(9, theCells[9+n]);
		GooseCell oie2 = new GooseCell(18, theCells[18+n]);
		GooseCell oie3 = new GooseCell(27, theCells[27+n]);
		GooseCell oie4 = new GooseCell(36, theCells[36+n]);
		GooseCell oie5 = new GooseCell(45, theCells[45+n]);
		GooseCell oie6 = new GooseCell(54, theCells[54+n]);
		TrapCell piege = new TrapCell(31, 1000);
		TrapCell piege2 = new TrapCell(52, 1000);
		WaitCell attente = new WaitCell(19, 2);
		TeleportationCell tele = new TeleportationCell(6, theCells[12]);
		TeleportationCell tele2 = new TeleportationCell(42, theCells[30]);
		TeleportationCell tele3 = new TeleportationCell(58, theCells[1]);
		theCells[9]=oie1;
		theCells[18]=oie2;
		theCells[27]=oie3;
		theCells[36]=oie4;
		theCells[45]=oie5;
		theCells[54]=oie6;
		theCells[31]=piege;
		theCells[52]=piege2;
		theCells[19]=attente;
		theCells[6]=tele;
		theCells[42]=tele2;
		theCells[58]=tele3;
 
	}

sachant que la classe dans laquelle je suis est une classe abstraite, et que mon tableau et declaré au debut de cette classe.


Merci