看板 Programming 關於我們 聯絡資訊
請問為什麼在mymethod裡面可以用this,但不可以用e 我用eclipse所得到error message是 e cannot be resloved 是因為e是main裡面的區域函式嗎??? 但是non-static不是可以直接存取static嗎??? public class Hello { int a=5; int b=30; public static void main(String[] args) { int a =10; System.out.println(a); Hello e = new Hello(); e.mymethod(3); System.out.println(e); } void mymethod (int a) { System.out.println(a); System.out.println(this.a); System.out.println(e); //為什麼這裡不能用e { int b=9; System.out.println(b); System.out.println(this.b); } System.out.println(b); } } -- ※ Origin: SayYA 資訊站 <bbs.sayya.org> ◆ From: 163.23.216.208