(1-4)请阅读程序,根据提示补全程序空白处,使程序能够正确运行。 class A{ } class B extends A{ } class C extends B{ } intece Info
{ // 在接口上定义泛型 public T getVar(); // 定义抽象方法 } class InfoImpl
implements Info< 1 > { // 定义泛型接口的子类 private T var ; public InfoImpl() {} public InfoImpl(T var ) { this .setVar( var ); } public T getVar() { return this . var ; } } public class Demo4 { //show 的形参是 C 的父类 public static void show(InfoImpl< 2 > info ) { System. out .println( info ); } public static void main(String arsg []) { Info
i = null ; // 声明接口对象 i = new InfoImpl< 3 >( " 孙悟空 " ); // 通过子类实例化对象 System. out .println( " 信息: " + i .getVar()); show ( new InfoImpl
()); } }