public void drawDiamond(int num){
char[][] b = new char[num][num];
if(oddNumber(num)){
for(int i = 0;i <= num-1;i++){
for(int j = 0;j <= num-1;j++){
if((i + j == num/2 )||(i + j == num + 1)||(i - j == num/2)||(j - i == num/2) ){
b[i][j] = '*';
}else{
b[i][j] = ' ';
}
}
}
}else{
for(int i = 0;i <= num-1;i++){
for(int j = 0;j <= num-2;j++){
if((i + j == num/2-1)||(j - i == num/2-1)||(i - j == num/2)||(i + j == num-2+num/2)){
b[i][j] = '*';
}else{
b[i][j] = ' ';
}
}
}
for(int i = 0;i <= num-1;i++){
for(int j = 0;j <= num-1; j++){
System.out.print(b[i][j]);
}
System.out.println();
}在这里编译器报错,(语法错误,将“}”插入到完整 Block 中)
}