当前位置:编程学习 > JAVA >>

泛型接口的实现方式之二

inte易做图ce Info<T>{
public T getvar();
}
class Infodemo implements Info<String>{
private String var;
public Infodemo(String var){
this.var = var;
}
public void setVar(String var){
this.var = var;
}
@Override
public String getvar() {
// TODO Auto-generated method stub
return this.var;
}
}
public class Pet{
public static void main(String args[]){
Info<String> var = new Infodemo("李兴华");
System.out.println("内容:"+var.getvar());
}
} 

 

补充:软件开发 , Java ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,