class A
{
A(String str)
{
System.out.println("A");
}
class B
{
B(String str)
{
System.out.println("B");
}
class C
{
C(String str)
{
System.out.println("C");
}
}
}
}
public class Test extends A.B.C
{
/*问题这里构造函数应该如何编写呢*/
Test()
{
}
}
String in = "TestStr";
A.B.C out = new A(in).new B(in).new C(in);
输出:A
B
C
和C的保持一致
/**
*
*/
package test;
import test.A.B;
/**
* @author yinwoods
* 2015年12月29日
*/
public class Test extends A.B.C {
/**
* @param b
* @param str
*/
public Test(B b, String str) {
b.super(str);
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
A.B b = new A("A1").new B("B2");
Test test = new Test(b, "C3");
}
}
class A {
A(String str) {
System.out.println(str);
}
class B {
B(String str) {
System.out.println(str);
}
class C {
C(String str) {
System.out.println(str);
}
}
}
}
A1
B2
C3
打印结果为:
这样做是对的,但具体原因我也没弄懂。