DESKTOP-86ONKLH_20200907-刘天阳

一、问题

class A {
     public int func1(int a, int b) {
         return a - b;
     }
 }
 class B extends A {
     public int func1(int a, int b) {
         return a + b;
     }
 }
 public class ChildClass {
     public static void main(String[] args) {
     A a = new B();
     B b = new B();
     System.out.println("Result=" + a.func1(100, 50));
         
     System.out.println("Result=" + b.func1(100, 50));
     }
 }

编译看左边,运行看右边

二、吐槽

有点热