What is difference between static and global variable in java?

2014-07-06 06:30:02 阅读( 1 )

2180人 收藏本页

标签:Java面试题

1. Static variables:
Static or class variables are initialized when the class is loaded into the JVM. These static variables usually can be accessible without creating instance of a class. Mostly it is used to declare constant values.
2. Global variables:
AFAIK, java doesn’t support global variable but however you can declare variables as public which can be accessed by inside/outside classes/packages.

来自IT公司面试手册

下一篇:how is a singleton class different from declaring a class with all methods static

上一篇:Simple Java questions and answers

亲~ 如果您有更好的答案 可在评论区发表您独到的见解。

您想查看更多的信息: 面试题