简体   繁体   中英

Inner class and static context

根据JLS§8.1.3,为什么Java不允许在Inner类中使用静态上下文?

Inner class will belong to instance of its Outer class.

If Java accept static non final variables in inner class, then there may be different values for that static variables for different instances of outer class.

Its totally against the static context definition.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM