WON.dev
chapter01 : inheritance 본문
package org.joonzis.ex;
// 부모 클래스
class Parent{
int number;
void doParent() {
System.out.println("doParent() 호출");
}
}
// 자식 클래스
class Child extends Parent{
void doChild() {
System.out.println("doChild() 호출");
}
}
public class Ex01_Inheritance {
public static void main(String[] args) {
Child child = new Child();
child.number = 10;
System.out.println(child.number);
child.doParent();
child.doChild();
}
}
'JAVA > chapter13_inheritance_annotation' 카테고리의 다른 글
Test . inheritance (0) | 2023.05.26 |
---|---|
chapter05 : constructor (0) | 2023.05.26 |
chapter04 : constructor (0) | 2023.05.26 |
chapter03 : inheritance (0) | 2023.05.26 |
chapter02 : inheritance (0) | 2023.05.26 |