日期:2014-05-20 浏览次数:20767 次
class Base { class Base { public static int count = 0; } class ClassOne extends Base { } public class Test { public static void main(String args[]) { System.out.println(Base.count); System.out.println(ClassOne.count); ClassOne.count++; System.out.println(Base.count); } }
class Base { public static int count = 0; } class ClassOne extends Base { public static int count=1; } public class Test { public static void main(String args[]) { System.out.println(Base.count); System.out.println(ClassOne.count); ClassOne.count++; System.out.println("Base的count值:"+Base.count); System.out.println("ClassOne的count值:"+ClassOne.count); } }
------解决方案--------------------
是一个变量,都是从Base类得到的