class demo5_father {
public int add(int a, int b) {
return a + b;
}
}
class demo5_son extends demo5_father{
public int add(int a,int b){
return a*a+b*b;
}
}
class test{
public static void main(String[] args) {
demo5_father d__ = new demo5_father();
System.out.println(d__.add(2,3));
demo5_son d_ = new demo5_son();
System.out.println(d_.add(2,3));
demo5_father d = new demo5_son();
System.out.println(d.add(2,3));
}
}
java 的 父与子
最新推荐文章于 2022-04-21 13:22:40 发布