我有這樣的代碼:找不出如何解決一個變量
import java.util.Scanner;
public class lectureArray {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter a number: ");
int n = sc.nextInt();
int [] arr = new int[n];
for(int i = 0; i < n; i++)
arr[i] = sc.nextInt();
for(int i = n-1; i >= 0; i--);
System.out.println(arr[i]) ;
}
}
,我有這樣的錯誤:「我不能被解析爲一個變量」。 無論我試圖擺脫它多少,它只是犯了更多的錯誤或不解決錯誤首先
刪除'for(int i = n-1; i> = 0; i - );' – ortis 2015-03-31 11:53:51
[This](http://stackoverflow.com/a/15786982/2557685)上的最後一個分號解釋有和沒有大括號的循環的區別。 – RegisteredUser 2015-03-31 11:59:56