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