2020
10-24
10-24
Java private修饰符失效的原因
失效之Java内部类在一个内部类里访问外部类的private成员变量或者方法。publicclassOuterClass{privateStringlanguage="en";privateStringregion="US";publicclassInnerClass{publicvoidprintOuterClassPrivateFields(){Stringfields="language="+language+";region="+region;System.out.println(fields);}}publicstaticvoidmain(String[]args){OuterClassouter=ne...
继续阅读 >