[問題] SCJP練習題
public class Test{
public int aMethod(){
static int i = 0;
i++;
return i;
}
public static void main(String args[]){
Test test = new Test();
test.aMethod();
int j = test.aMethod();
System.out.println(j);
}
}
請問一下是錯在哪阿?
我看解答是i一定要是final(當然沒有i++)這樣就可以了,why?
懇請各位高手指導
感謝~~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.216.44.240
推
01/08 12:18, , 1F
01/08 12:18, 1F
討論串 (同標題文章)