A: public class Student extends People{}
B: public class Student implements People{}
C: public class Student extends Teacher People{}
D: 以上都不正确
举一反三
- 下面声明正确的是( )。 A: abstract final class Student{} B: public abstract class Student{} C: class Student extends Person,Parent{} D: private class Person{}
- 对于下列代码,下列哪个叙述是正确的 class People { People(int m) { } } class Student extends People { }
- 假设C和D是接口,下列定义哪个是正确的() A: public class A implements C,D{ } B: public class A implements C implements D{ } C: public class A extends C,D{ } D: public class A extends C extends D{ }
- 下面哪些语法结构是不正确的( ) A: public class A extends B implements C B: public class A implement A B C: public class A implements B,C,D D: public class A implements B
- 下面是几条定义类的语句,不能被继承的类是( )。 A: abstract class Student {} B: class Student{} C: public class Student{} D: sealed class Student{}
内容
- 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 {...}