题目内容

若有定义interface Person{},下面引用方式错误的是( )

A. class Student implements Person
B. class Student implements Person
C. class Student implements Person
D. class Student implements Person

查看答案
更多问题

下面是class Person{}中定义的方法,属于泛型方法的是( )

A. E void show(int a){}
B. T getData(){}
C. T Get(T a){}
D. T Get(E a)

{下面程序的编译运行结果是( )class GeneralClass{T data;GeneralClass(T data){this.data = data;}public void show(E a,T b){System.out.print(a);System.out.print(b);}}public class Demo2015 {public static void main(String []args){GeneralClass sObj = new GeneralClass("hello");System.out.print(sObj.data);sObj.show(1,"2");}}}

A. 编译错误,因为sObj.show(1,"2");中两个实参的类型不一致
B. 编译错误,因为类型参数E和T代表的数据类型不一致
C. hello12
D. 编译错误,因为sObj.show(1,"2")中实参的类型与参数T指定的类型不一致

下面有关通配符描述错误的是( )

A. 类型参数可以为任意类型
B. 是一样的
C. 类型限定为Number及其子类
D. 类型限定为Number及其父类

{现有类的定义如下:class Person{}class Student extends Person{}class Teacher extends Person{}class Box{}class Infor{Infor(T a){System.out.print(a);}}则下面语句错误的是( )}

A. Infor t =new Infor("hello");
B. Infor t1 = new Infor(new Teacher());
C. Infor t2 = new Infor(new Person());
D. Infor t3 = new Infor(new Box());

答案查题题库