public class A {
abstract class InputAlphabet{
public abstract void input();
}
}
public class B extends A {
public void input(){
for(char c='a';c<='z';c++){
System.out.println(c);
}
}
}
public class C {
void showMess(InputAlphabet show){
show.input();
}
}
public class D {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
C board=new C();
board.showMess(new B());
board.showMess(new A()
{
public void input(){
for (char c='a';c<='w';c++)
System.out.println(c);
}
}
);
}
}
不能运行,那里错了吗?而且为什么要这样写?
Coda
相关分类