1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
public class MyClass {
public static void main(String args[]) {
char board[][] = {
{'-','-','-','-','-','-','-','-'},{'-','-','-','-','-','-','-','-'},{'-','-','-','-','-','-','-','-'},{'-','-','-','-','-','-','-','-'},
{'-','-','-','-','-','-','-','-'},{'-','-','-','-','-','-','-','-'},{'-','-','-','-','-','-','-','-'},{'-','-','-','-','-','-','-','-'}
};
for (int i = 0; i < board.length; i++){
for (int j = 0; j < board.length; j++){
if (board[i][j] == '-'){
if ((i == 1) && (j == 2)) {System.out.print(" A");}
else System.out.print(" _");
if (j == board.length-1){
System.out.println();
}
}
}
}
}
} |