Skip to content

Instantly share code, notes, and snippets.

@takahashi-h5
Created August 26, 2019 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takahashi-h5/98e433a6db1da843d3aece68256c41ca to your computer and use it in GitHub Desktop.
Save takahashi-h5/98e433a6db1da843d3aece68256c41ca to your computer and use it in GitHub Desktop.
class Parent {
public void angry() {
System.out.println("こら");
}
}
class Child extends Parent{
public void sorry() {
System.out.println("ごめん");
}
}
public class Main {
public static void main(String[] args) {
Child chi = new Child(); // 子クラスの場合は親クラスのメソッドをそのまま使える
chi.angry();
chi.sorry();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment