class Mate{
class BrotherOfMate{
BrotherOfMate(){
System.out.println("construct BrotherOfMate");
}
}
Mate(){
System.out.println("construct Mate");
}
}
public class f9 extends Mate.BrotherOfMate{
//f9 继承,此处该如何写?
f9(Mate m){
m.super();
System.out.println("construct f9(I)");
}
public static void main(String[] args){
Mate m = new Mate();
f9 new_f9 = new f9(m);
f9.BroterOfI bo = new_f9.new BroterOfI(m);
}
class BroterOfI extends Mate.BrotherOfMate{
//BrotherOfI 继承,此处该如何写?
BroterOfI(Mate m){
m.super();
System.out.println("construct BrotherOfI");
}
}
}
class BrotherOfMate{
BrotherOfMate(){
System.out.println("construct BrotherOfMate");
}
}
Mate(){
System.out.println("construct Mate");
}
}
public class f9 extends Mate.BrotherOfMate{
//f9 继承,此处该如何写?
f9(Mate m){
m.super();
System.out.println("construct f9(I)");
}
public static void main(String[] args){
Mate m = new Mate();
f9 new_f9 = new f9(m);
f9.BroterOfI bo = new_f9.new BroterOfI(m);
}
class BroterOfI extends Mate.BrotherOfMate{
//BrotherOfI 继承,此处该如何写?
BroterOfI(Mate m){
m.super();
System.out.println("construct BrotherOfI");
}
}
}
不过,这样好象不行,想继承内部类
我想这个类至少应该是静态的
试一下这个:
class Mate{
static class BrotherOfMate{//设置为静态内部类
BrotherOfMate(){
System.out.println("construct BrotherOfMate");
}
} Mate(){
System.out.println("construct Mate");
}
}class f9 extends Mate.BrotherOfMate{//静态内部类可以直接用类名调用
f9(){
System.out.println("construct f9(I)");
} class BroterOfI {
BroterOfI(){
System.out.println("construct BrotherOfI");
}
} public static void main( String args[] )
{
new f9();
}
}不知道你要的是不是这样的结果?