當我嘗試編譯此代碼時,我得到一個錯誤,說如果沒有if。我相信我擁有正確的地方所有的大括號。我還得到了其他的錯誤信息,但我只相信他們在那裏,因爲如果錯誤不能使用其他錯誤。其他人無法找到If語句,即使有一個
問題代碼:
public static boolean goNorth(){
boolean success;
if(maze[currCol]currRow - 1] == CLEAR){
maze[currCol][startRow -1] = PATH;
currRow--;
success = goNorth();
if(!success){
success = goWest();
if(!success){
success = goEast();
if(!success){
maze[currCol][currRow] = VISITED;
currRow++;
}
}
}
return success;
} else {
return false;
}
}
public static boolean goWest(){
boolean success;
if(maze[currCol - 1]currRow] == CLEAR){
maze[currCol - 1][startRow] = PATH;
currRow--;
success = goWest();
if(!success){
success = goSouth();
if(!success){
success = goNorth();
if(!success){
maze[currCol][currRow] = VISITED;
currCol++;
}
}
}
return success;
} else {
return false;
}
}
public static boolean goEast(){
boolean success;
if(maze[currCol + 1]currRow] == CLEAR){
maze[currCol + 1][startRow] = PATH;
currRow--;
success = goEast();
if(!success){
success = goNorth();
if(!success){
success = goSouth();
if(!success){
maze[currCol][currRow] = VISITED;
currCol--;
}
}
}
return success;
} else {
return false;
}
}
public static boolean goSouth(){
boolean success;
if(maze[currCol]currRow + 1] == CLEAR){
maze[currCol][startRow + 1] = PATH;
currRow--;
success = goSouth();
if(!success){
success = goEast();
if(!success){
success = goWest();
if(!success){
maze[currCol][currRow] = VISITED;
currRow--;
}
}
}
return success;
} else {
return false;
}
}
錯誤:
發佈錯誤文本,而不是鏈接到圖像。 – 2013-04-25 13:49:47
如何使用任何IDE? – Vitaly 2013-04-25 13:50:54