class Parent { void print() { System.out.println("This is the parent class."); } } class Child extends Parent { void print() { System.out.println("This is the child class."); } } public class Main { public static void main(String[] args) { Child child = new Child(); child.print(); } } This is the parent class. This is the child class.


上一篇:
下一篇:
切换中文