基础----Java的作用域

class Scope{
    private int x;
    public int getX() {
        return x;
    }
    public void setX(int x) {
        this.x = x * 3;
    }
}

public class ScopeTest extends Scope{

    public static void main(String[] args) {
        int a = 100;
        Scope se = new Scope();
        se.setX(a);
        System.out.println(a);  // 这里输出多少 ?
    }
}

output: 100

posted @ 2014-02-21 16:17  小菜喵  阅读(118)  评论(0编辑  收藏  举报