首页 > 试题广场 >

请说出E类中【代码1】~【代码4】的输出结果。 class

[问答题]
请说出E类中【代码1】~【代码4】的输出结果。
class A{
    double f(double x,double y){
        return x+y;
    }
    static int g(int n){
        return n*n;
    }
}
class B extends A{
    double f(double x,double y){
        double m=super.f(x,y);
        return m+x*y;
    }
}
static int g(int n){
    int m=A.g(n);
    return m+n;
}
public class E{
    public static void main (String args[]){
        B b=new B();
        System.out.println(b.f(10.0,8.0));  /【代码1】
        System.out.println(b.g(3));  //【代码2】
        A a = new B();
        System.out.println(a.f(10.0,8.0));  //【代码3】
        System.out.println(a.g(3));  //【代码4】
    }
}

222
发表于 2019-09-18 13:17:15 回复(0)
89.0
12
18.0
9
编辑于 2019-09-18 09:38:09 回复(0)