JAVA/예제

[JAVA] ch07-05. 객체 지향 5

밍글링글링 2017. 8. 22. 11:36
728x90
 
public class Ex05 {
    public static void main(String[] args){
        Descendant descendant = new Descendant();
        descendant.method();
    }
}

class Descendant extends Parent{
    int x = 20;
    
    void method(){
        System.out.println("x= "+x);
        System.out.println("this.x= "+this.x);
        System.out.println("super.x= "+super.x);
    }
}

728x90