外部类中有内部接口、内部抽象类和内部类。
当我调用OuterClass的outerMethod()方法时,
AKindBiz 类的方法只能打印列表的内容。
为什么抽象类(CommonKindBiz)的方法不能打印任何东西?
public class OuterClass {
public void outerMethod( ) throws Exception{
ArrayList<String> list = new ArrayList<String>();
list.add("1111");
list.add("2222");
KindBiz biz = new AKindBiz();
biz.execute(list);
}
public interface KindBiz
{
public void execute( ArrayList<String> inputList) throws Exception;
public void preExec( ArrayList<String> inputList) throws Exception;
public void exec( ArrayList<String> inputList) throws Exception;
public void postExec( ArrayList<String> inputList) throws Exception;
}
abstract public class CommonKindBiz implements KindBiz
{
public void execute( ArrayList<String> inputList) throws Exception{
System.out.println("KindBiz.CommonKindBiz.execute ### inputList1 : " + inputList ); // Nothing printed.
this.preExec(inputList);
this.exec(inputList);
this.postExec(inputList);
}
public void preExec( ArrayList<String> inputList) throws Exception
{
System.out.println("KindBiz.CommonKindBiz.preExec ### inputList : " + inputList ); // Nothing printed.
}
public abstract void exec( ArrayList<String> inputList) throws Exception;
public void postExec( ArrayList<String> inputList) throws Exception
{
System.out.println("KindBiz.CommonKindBiz.postExec ### inputList : " + inputList ); // Nothing printed.
}
}
public class AKindBiz extends CommonKindBiz
{
@Override
public void exec( ArrayList<String> inputList) throws Exception
{
System.out.println("KindBiz.AKindBiz.exec ### inputList : " + inputList ); // "1111", "2222" printed.
}
}
}
先感谢您。