小编chr*_*_cx的帖子

JAVA - 无法调用我的数组方法

Eclipse说:'chiffres无法解析为变量',如何修复调用方法?

public class Table {

public static void main(String[] args) {


    Tableau1 table = new Tableau1();


    table.CreerTable();
    table.AfficherTable(chiffres);

}}
Run Code Online (Sandbox Code Playgroud)

part:和类Tableau1 with array:声明它

public class Tableau1 {
int [][] chiffres;
int nombre;
public void CreerTable(){

    int[][] chiffres= {{11,01,3},
                        {12,02,4},
                        {12,03,5}};
    //edited
    this.chiffres=chiffres;


}

public int[][] AfficherTable(int[][] chiffres){
    this.nombre=12;
    for(int i=0;i<2;i++){

    System.out.println("essai"+chiffres[i][1]);
    if(chiffres[i][0]==nombre){System.out.println("ma ligne ="+chiffres[i][0]+","+chiffres[i][1]+","+chiffres[i][2]);
                                };

                        }
                        return chiffres;
}
Run Code Online (Sandbox Code Playgroud)

}

非常感谢

java arrays methods call

1
推荐指数
1
解决办法
127
查看次数

标签 统计

arrays ×1

call ×1

java ×1

methods ×1