Static Context: What Does it REALLY mean?
Friends,
I really having this trouble of grabbing the idea of static context vs non-static context.
Lets say I have a static method, is that mean that all items (variables and calls) inside it are assumed to be static as well?
Thanks in advance.
Any statement or expression inside the static method is said to "occur in a static context". In such a method - like the traditional main() method - only static members and methods can be used.
(Statements and expressions occuring in lots of other places are also said to occur in a static context - see the JLS http://java.sun.com/docs/books/jls/third_edition/html/classes.html#296300 for details. In a loose sense what these contexts have in common is that they "belong" to the class as a whole, rather than to any specific instance: they relate to class wide things and operations.)