SLeeVe
2025-03-26
有人知道为什么Java17支持普通内部类,可以定义静态变量(非static final)、静态方法和静态代码块吗? class Outer { class Inner { static int staticField = 10; static void staticMethod() { System.out.println("Static method in non-static inner class!"); } static { System.out.println("Static block"); } } }
0个评论
点击登录,快来和大家讨论吧~
表情
图片
暂无评论
下载 APP