public class Project1 {
public static void main(String [] args) {
//ScrabbleLetterBag letterBag = new ScrabbleLetterBag();
char [][] scrabbleBoard = new char [15][15];
for (int i = 0; i <=scrabbleBoard.length; i++) {
if (i != 0) {
System.out.println(" ");
System.out.print(i - 1);
}
for (int j = 0; j <=scrabbleBoard.length; j++) {
if (j == 8 && i == 8) {
scrabbleBoard[i][j] = '*';
System.out.print(scrabbleBoard[i][j]);
}
else {
if (i == 0) {
System.out.print(" "+j);
}
else{
scrabbleBoard[i][j] = '_';
System.out.print(" ");
System.out.print(scrabbleBoard[i][j]);
}
}
}
}
}
/*int count = 0;
char myLetter;
while (!letterBag.isEmpty()) {
count++;
myLetter = letterBag.getLetter();
System.out.print(myLetter);
if (count % 10 == 0)
System.out.println();
}*/
}
應該打印出類似需要幫助打印拼字板!
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 3 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 4 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 5 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 6 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 7 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 8 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 9 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 10 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 11 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 12 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 13 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 14 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
出於某種原因,我的代碼是不工作的幫助我解決它PLZ
什麼是不工作?它是否編譯?有什麼打印? – 2011-03-12 04:47:14
你不會在你的預期輸出中的任何地方顯示'*',但它在你的代碼中。 – 2011-03-12 04:48:24
這不是打印行14 – ZZZ 2011-03-12 04:49:51