1 abstract class Report { 2 void runReport() { 3 System.out.println("设置报告"); 4 } 5 6 void printReport(){ 7 System.out.println("输出报告"); 8 } 9 } 10 11 public class BuzzwordsReport extends Report { 12 void runReport() { 13 //在这里写代码 14 super.runReport();//调用父类的同时覆盖了父类,super 15 System.out.println("子类输出报告"); 16 } 17 18 public static void main(String[] args) { 19 BuzzwordsReport br = new BuzzwordsReport(); 20 br.runReport(); 21 } 22 }