package com.shrimpking.t1;
/**
* Created by IntelliJ IDEA.
*
* @Author : Shrimpking
* @create 2024/9/28 18:23
*/
class staticInnerDemo {
//外部类
private static int x = 4; //静态成员
private int y = 5; //成员变量
public static class Inner{
//静态内部类
public void method(){
System.out.println(x);
//System.out.println(y); //错误
}
}
}
public class StaticInnerClassApp5_1
{
public static void main(String[] args)
{
//实例化内部类
staticInnerDemo.Inner inner = new staticInnerDemo.Inner();
inner.method();
}
}
StaticInnerClassApp5_1
最新推荐文章于 2024-11-10 09:25:34 发布