本文介绍了为什么内部类没有静态块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 昨天晚上我正在学习内部课程,我遇到了一个Inner Class不支持Static Block的事情...... 我需要解释..Please!解决方案 内部类不需要静态块,因为它们可以使用包含它们的外部类的静态块 。 /> 亲切的问候, Jos 谢谢:-) 这意味着如果加载了内部类,那么封装类就会被加载。 但是这段代码片段工作不正常,意味着外部类静态块没有运行。 展开 | 选择 | Wrap | 行号 Yesterday night i was learning inner class there i came across a thing that Inner Class does not support Static Block ...I need the explanation ..Please! 解决方案Inner classes don''t need static blocks because they can use the static blocksof the outer class that embraces them.kind regards,JosThanks :-)That means if inner class loaded then enclosing class gets loaded.But this code snippet is not working properly, means outer class static block is not running. Expand|Select|Wrap|Line Numbers 这篇关于为什么内部类没有静态块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!