ν…œν”Œλ¦Ώ

μƒμœ„ 좔상 ν΄λž˜μŠ€κ°€ λŒ€λž΅μ μΈ λ‘œμ§μ„ μž‘μ•„λ‘κ³  μ‹€μ œλ‘œ μƒμ„Έν•œ κ΅¬ν˜„μ€ 상속을 λ°›μ•„ κ΅¬ν˜„μ„ κ°•μ œν•˜λ„λ‘ ν•˜λŠ”κ²ƒ

public abstract class Car {
 public void playWithOwner() {
   System.out.println("Start");

   play();

   runSomeThing();
 }

 abstract void play();

 void runSomething() {
   System.out.println("Something");
 }
}
public class Auto extends Car {
  @Override
  void play() {
    System.out.println("move Car");
  }

  void runSomething() {
    System.out.println("Something others");
  }  
}
public class Main {
  public static void main(String[] args) {
    Car auto = new Auto();

    auto.playWithOwner();
  }
}
Start
move Car
Something others