首页 > 解决方案 > 如何在Java中的二维字符数组的mutator(setter)方法中传递值?

问题描述

所以我创建了这个方法,

   public void setarray(char[][]a)
   {
     board=a;
   }

并希望通过我的 Main 函数在 2D 数组中传递值 3 和 3。

    test.setRow(3);
    test.setCol(3);
    test.setarray[][]

基本上,设置为 3 的 Row 和 Col 值应该由该数组使用。

我怎么做?我收到一个错误。

标签: javaarrays2dsetter

解决方案


推荐阅读