• 2022-06-16
    下面关于子类继承父类,正确的是( )。
    A: public class Student extends People{}
    B: public class Student implements People{}
    C: public class Student extends Teacher People{}
    D: 以上都不正确
  • A

    内容

    • 0

      class Person{} class Student extends Person{ public int id; public int score; public String name; public int getScore() { return score; }

    • 1

      下面关于类的声明,正确的是_____ A: public class Student{…} B: public void ST{…} C: public void th(){…} D: public class void num{ }

    • 2

      (1+X)假设 C 是抽象类,I1 和 I2 是接口。下列关于抽象类或接口的定义,哪一个是正确的( )。 A: public class A extends C implements I1,I2{} B: public class A extends I1,I2 implements C{} C: public class A implements I1,I2 extends C {} D: public class A extends C, I1, I2 {}

    • 3

      阅读程序题(给出【代码】注释标注的代码的输出结果)interface Com {int add( int a, int b);}abstract class People {abstract int add( int a, int b);}class Student extends People implements Com{public int add(int a,int b) {return a + b;}}public class 习题5_阅读3 {public static void main(String args[ ]) {Student stu = new Student ();Com com = stu;int m = com.add(12,6);People p = stu;int n = p.add(12,8);System.out.printf("%d:%d",m,n); //【代码】}}

    • 4

      A类同时实现接口B和接口C,正确的写法是: A: public class A implements B, implements C {...} B: public class A implements B, C {...} C: public class A interface B, iinterface C {...} D: public class A extends B, C {...}