Java basics-use the stack variable-general Linux technology-Linux programming and kernel information as much as possible. For details, refer to the following section. If you frequently access variables, you need to consider where to access them. Is the variable static, stack, or instance variable of the class? Does the storage location of a variable significantly affect the performance of the code that is accessed? For example, consider the following code:
CODE: class StackVars
{
Private int instVar;
Private static int staticVar;
// Access stack variables
Void stackAccess (int val)
{
Int j = 0;
For (int I = 0; I j + = 1;
}
// Instance variables of the access class
Void instanceAccess (int val)
{
For (int I = 0; I instVar + = 1;
}
// Access static variables of the class
Void staticAccess (int val)
{
For (int I = 0; I staticVar + = 1;
}
} |