public class MakeQuilt {
public static void main (String[] args){
char [][] myBlock = new char [4][5];
char [][] myQuilt = new char [12][4];
for(int row = 0; row < myBlock.length; row++){
for(int column = 0; column < myBlock[row].length; column++){
if(column == 0 || row == 3)
myBlock[row][column]='X';
else if(row == column || (row == 2 && column == 1))
myBlock[row][column]='+';
else
myBlock[row][column]='.';
}
}
displayPattern(myBlock);
displayPattern(myQuilt);
}
public static void displayPattern(char[][] myBlock){
for(int row = 0; row < myBlock.length; row++){
for(int column = 0; column < myBlock[row].length; column++){
System.out.print(myBlock[row][column]);
}
System.out.println();
}
System.out.println();
}
public static void fillQuilt(char[][] myQuilt){
for(int row = 0; row < myQuilt.length; row++){
for(int column = 0; column < myQuilt[row].length; column++){
myQuilt[row][column] =('?');
}
}
}
}
내 char 배열 myQuilt가 물음표로 채워지지 않고 대신 아무것도 채워지지 않은 이유를 알 수없는 것 같습니까? (출력은 0을 보여줍니다). myQuilt 배열에서?를 출력하도록 displayPattern 메서드를 변경하는 방법을 잘 모르겠습니다.내 배열이 '?'로 채워지지 않는 이유는 무엇입니까?
물음표로 채우지 않았기 때문에 물음표가 채워지지 않습니다. – immibis