■ Static variables have the longest scope; they are created when the class is
loaded, and they survive as long as the class stays loaded in the Java Virtual
Machine (JVM).
■ Instance variables are the next most long-lived; they are created when a new
instance is created, and they live until the instance is removed.
■ Local variables are next; they live as long as their method remains on the
■ Block variables live only as long as the code block is executing.

No comments:

Post a Comment