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
    
    
  'JAVA > 예제' 카테고리의 다른 글
| [JAVA] ch07-08. 객체 지향 8 (0) | 2017.08.22 | 
|---|---|
| [JAVA] ch07-06. 객체 지향 6 (0) | 2017.08.22 | 
| [JAVA] ch07-04. 객체 지향 4 (0) | 2017.08.22 | 
| [JAVA] ch07-03. 객체 지향 3 (0) | 2017.08.22 | 
| [JAVA] ch07-02. 객체 지향 2 (0) | 2017.08.22 | 
			
			
				
			
댓글