Bonjour,
J'aimerais qu'un objet initialise un tableau a deux dimensions suivant un paramètre
Mais je reçois des "illegal start of expression" a chaque ligne qui initialise ce tableau..

Pouvez vous m'aider ?

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
37
38
package com.fvp.SandBox;
 
 
public class Test01 {
 
    private int[][] mapper;
 
    public Test01() {
        configure(1);
    }
 
    private void configure(int n) {
        switch(n) {
            case 2 : 
                this.mapper = { 
                    {0,2},
                    {1,3}
                    };
                break;
            case 3 : 
                this.mapper = { 
                    {0,2,4,6}, 
                    {1,3,5,7} 
                    };
                break;
            case 4 : 
                this.mapper = { 
                    {0, 4, 8,12}, 
                    {1, 5, 9,13},
                    {2, 6,10,14},
                    {3, 7,11,15}
                    };
                break;
            default:
                throw new IllegalArgumentException("configure: n must be in [2,3,4");
            };
        }
    }