public abstract class A implements B不太理解implements B 的是什么意识?
网友回答
【答案】 泛型技术,看完代码,你将知道很多.
public interface B {
public T get();
}
public abstract class A implements B {
/*实现接口的方法时,就会默认用 Object 表示返回值.*/
public Object get() {
//code here,and return a Object type value.
return null;
}
}
public abstract class C implements B {
/*实现接口的方法时,就会默认用 Integer 表示返回值.*/
public Integer get() {
//code here,and return a Integer type value.
return null;
}
}