Java中的全局变量如何在Java中定义全局变量?
3 回答
翻翻过去那场雪
TA贡献2065条经验 获得超14个赞
public class Example { public static int a; public static int b;}
Example.a;Example.b;
摇曳的蔷薇
TA贡献1793条经验 获得超6个赞
public class Globals { public static int globalInt = 0; ///}
萧十郎
TA贡献1815条经验 获得超13个赞
public interface GlobalConstants{ String name = "Chilly Billy"; String address = "10 Chicken head Lane";}
public class GlobalImpl implements GlobalConstants{ public GlobalImpl() { System.out.println(name); }}
添加回答
举报
0/150
提交
取消