Я получаю ошибки, которые не могу исправить. Я получаю около 8 ошибок в этих строках:Ошибки с апплетом java
if (weight [1] + weight[4] + weight[7] == twoWeights){
if(weight[1]==0){
return 1;
else if (weight [4] == 0)
return 4;
else
return 7;
}
if (weight [2] + weight[5] + weight[8] == twoWeights){
if(weight[2]==0)
return 2;
else if (weight [5] == 0)
return 5;
else
return 8;
}
if (weight [0] + weight[4] + weight[8] == twoWeights){
if(weight[0]==0)
return 0;
else if (weight [4] == 0)
return 4;
else
return 8;
}
if (weight [2] + weight[4] + weight[6] == twoWeights){
if(weight[2]==0)
return 2;
else if (weight [4] == 0)
return 4;
else
return 6;
}
return -1;
}
int getRandomSquare(){
boolean gotEmptySquare = false;
int selectedSquare = -1;
do {
selectedSquare = (int) (Math.random() * 9);
if (squares[selectedSquare].getLabel().equals("")){
gotEmptySquare = true;
}
}
while (!gotEmptySquare);
return selectedSquare;
}
void highlightWinner(int win1; int win2; int win3) {
squares [win1].setBackground(Color.CYAN);
squares [win2].setBackground(Color.CYAN);
squares [win3].setBackground(Color.CYAN);
}
void endTheGame(){
newGameButton.setEnabled(true);
for(int i=0;i<9;i++){
squares[i].setEnabled(false);
}
}
}
}
Ошибки:
TicTacToe.java:213: 'еще' без 'если' еще, если (вес [4 ] == 0) ^
TicTacToe.java:256: ';' Ожидается, ИНТ getRandomSquare() { ^
TicTacToe.java:269: незаконное начало выражения недействительным highlightWinner (интермедиат win1; INT win2; INT win3) {^
TicTacToe.java:269: ';' ожидаемый void highlightWinner (int win1; int win2; int win3) { ^
TicTacToe.java:269: ';' Ожидается, аннулируются highlightWinner (интермедиат win1; INT win2; ИНТ win3) { ^
TicTacToe.java:274: незаконное начало выражения ничтожной endTheGame() { ^
TicTacToe.java:274: «; ' Ожидается, аннулируются endTheGame() { ^
Вам нужно больше внимания уделять отслеживанию следов, и вы сможете исправить все проблемы. – alnasfire