java在2D数组中的特定位置替换字符?
我有两个整数代表二维字符数组中的一个特定位置,我正在尝试编写一个方法,将这些整数作为数组中的索引位置,并用一个新字符替换它们(然后,该方法将数组返回到主方法)
以下是(当前为空)方法:
public static char[][] playerMoveDown(int playerPosR, int playerPosC, char[][] mazeGrid) {
}
我想做点什么来达到这个效果:
mazeGrid[][].setCharAt(mazeGrid[playerPosR][playerPosC], '.');
但是对于字符数组有效(因为setCharAt只对字符串有效)。有什么简单易行的方法
# 1 楼答案
怎么样
# 2 楼答案
那么这个呢:
我建议在继续之前先熟悉数组语法