+ 1
Are static variables or methods treated similarly to a global variable or method?
In other terms, can "global" and "static" be used relatively interchangeably?
1 Resposta
+ 4
No. Global variables and static variables are different.
That said, there are no global variables in Java, let alone a "global" keyword, as far as I am concerned. The closest you can get would be a class member defined as "public static".
"static" declares that the class member belongs to the class instead of the instance of the class, and "public" declares that the class member can be accessed by other classes.