WON.dev
chapter03 : inheritance 본문
package org.joonzis.ex;
class Car{
void move() {
System.out.println("움직인다.");
}
}
class Ev extends Car{
void charging() {
System.out.println("전기를 충전한다.");
}
}
public class Ex03_Inheritance {
public static void main(String[] args) {
Ev ev = new Ev();
ev.charging();
ev.move();
}
}
'JAVA > chapter13_inheritance_annotation' 카테고리의 다른 글
Test . inheritance (0) | 2023.05.26 |
---|---|
chapter05 : constructor (0) | 2023.05.26 |
chapter04 : constructor (0) | 2023.05.26 |
chapter02 : inheritance (0) | 2023.05.26 |
chapter01 : inheritance (0) | 2023.05.26 |