因为数组下标越界了String[][] matrix=new String[x] [y];matrix[x][y]的下标范围是[0 - (x-1)][0 - (y - 1)]数组的最后一位是matrix[x-1][y-1]
下标越界了。。。