*/ --------------------------------------------------------------------------------------
*/ 出自: 编程中国 http://www.bc-cn.net
*/ 作者: neverTheSame E-mail:zhaoxufeng9997@126.com QQ:475818502
*/ 时间: 2007-11-8 编程论坛首发
*/ 声明: 尊重作者劳动,转载请保留本段文字
*/ --------------------------------------------------------------------------------------
Java类中的内部类的嵌套个数最多为59个.如果发现有比较59还多的,可以与我探讨.
以下是我的一个例子,以供参考:
class c1
{
class c2
{
class c3
{
class c4
{
class c5
{
class c6
{
class c7
{
class c8
{
class c9
{
class c10
{
class c11
{
class c12
{
class c13
{
class c14
{
class c15
{
class c16
{
class c17
{
class c18
{
class c19
{
class c20
{
class c21
{
class c22
{
class c23
{
class c24
{
class c25
{
class c26
{
class c27
{
class c28
{
class c29
{
class c30
{
class c31
{
class c32
{
class c33
{
class c34
{
class c35
{
class c36
{
class c37
{
class c38
{
class c39
{
class c40
{
class c41
{
class c42
{
class c43
{
class c44
{
class c45
{
class c46
{
class c47
{
class c48
{
class c49
{
class c50
{
class c51
{
class c52
{
class c53
{
class c54
{
class c55
{
class c56
{
class c57
{
class c58
{
class c59
{
class c60
{
int i=3;
int j=54;
void show()
{
System.out.println("i="+i+"\nj="+j);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
class c3
{
public static void main(String args[])
{
c1.c2.c3.c4.c5.c6.c7.c8.c9.c10.c11.c12.c13.c14.c15.c16.c17.c18.c19.c20.c21.c22.c23.c24.c25.c26.c27.c28.c29.c30.c31.c32.c33.c34.c35.c36.c37.c38.c39.c40.c41.c42.c43.c44.c45.c46.c47.c48.c49.c50.c51.c52.c53.c54.c55.c56.c57.c58.c59.c60 v1=new c1().new c2().new c3().new c4().new c5().new c6().new c7().new c8().new c9().new c10().new c11().new c12().new c13().new c14().new c15().new c16().new c17().new c18().new c19().new c20().new c21().new c22().new c23().new c24().new c25().new c26().new c27().new c28().new c29().new c30().new c31().new c32().new c33().new c34().new c35().new c36().new c37().new c38().new c39().new c40().new c41().new c42().new c43().new c44().new c45().new c46().new c47().new c48().new c49().new c50().new c51().new c52().new c53().new c54().new c55().new c56().new c57().new c58().new c59().new c60();
v1.show();
}
}