I flipped through the new Java entry book last night and suddenly saw three variables in Java:
1. Local variable 2. instance variable 3. Class variable
Local variables are easy to understand. The scope and life cycle are the same as those in the Delphi function, but the two or three variables are somewhat confusing. I checked the information online and found the answer.
An instance variable means that when a class has multiple instances, there are as many instances as the variable, that is, an instance has the operation permission of an instance variable, you cannot change the instance variables of other instances.
In fact, class variables are somewhat like "global variables" in Delphi, and are "engineering-level" global variables. Referencing in Delphi is like a unit to operate on another unit variable, similar meaning. In Java, multiple class instances use one variable together. The variable that can be operated by multiple class instances is a class variable in Java.
Local variables exist in the stack, and the computing speed is very fast, while the calculation speed of instance variables and class variables is very slow. They are stored in a constant storage zone, JVM requires specialized maintenance and optimization, which is included in csdn.ArticleThe address of how to improve the efficiency of variable usage is:
Http://dev.csdn.net/article/34/34382.shtm
For more information, see.
Learning a new language is to start from scratch ~~~~~~~