728x90 java super class1 [JAVA] ch07-16. 객체 지향 16 public class Ex16 { public static void main(String[] args){ Super parent = new Sub3(); Sub3 child = new Sub3(); parent.method(); System.out.println(); child.method(); } } class Sub3 extends Super{ int x= 200; void method(){ System.out.println("x="+x); System.out.println("this.x="+this.x); System.out.println("super.x="+super.x); super.method(); //꼼수 } } JAVA/예제 2017. 8. 22. 이전 1 다음 728x90