|
Scope
|
|
The region of a program where the entity can be referred to using a simple name (unless it is shadowed)).
|
| Shadowing
|
|
A declarations is shadowed in part of its scope by another declaration of the same name, so a simple name cannot refer to the declared entity.
|
int x = 1;
{
int x = 0;
}
|
| Obscuring
|
|
The same name at times may be interpreted as a variable, a type or a package. Then a variable is preferred to a type, and a type is preferred to a package.
|
Object x = 1;
{
int Object = 0;
}
|
| Hiding
|
|
A member of a subclass hides the member of a superclass having the same name.
|
abstract class A {
int b;
static void c() {};
void d() {};
abstract String x();
};
class B extends A {
byte b /* hides A.b */;
static int c() { return 7; } /* hides A.c() */
void d() {} /* overrides A.d() */
String x() { return "X"; } /* implements A.x() */
};
|
| Overriding
|
|
A method of a subclass overrides the (non-abstract) method of a superclass having the same name and signature.
|
| Implementing
|
|
A non-abstract method of a subclass implements the abstract method of a superclass having the same name and signature.
|
|
Classes
|
| Anonymous Class
|
|
A class declared and instantiated by an instance creation expression.
|
| Inner Class
|
|
A non-staic nested class.
|
| Local Class
|
|
A nested class that has a name and is not a member class.
|
| Member Class
|
|
A class whose declaration is directly enclosed within another class or interface declaration.
|
| Nested Class
|
|
A class declared within a body of another class.
|
|
Threads and Locks
|
|
To synchronize threads, Java uses monitors, which are allow only one thread at a time to execute a region of code protected by the monitor. The behavior of monitors is explained in terms of locks; there is a lock associated with each object.
|
| Use
|
|
(thread) Transfers contents of variable's thread copy to the execution engine (instruction uses the value of a variable)
|
| Assign
|
|
(thread) Transfers value from execution engine into the variable's thread copy (assignment instruction).
|
| Read
|
|
(main memory) Transmits contents of variable's master copy to thread memory (to be used by load)
|
| Load
|
|
(thread) Puts a value from main memory (read) into variable's thread copy
|
| Store
|
|
(thread) transmits contents of variable's thread copy to main vmemory (to be used by write)
|
| Write
|
|
(main memory) puts a value from thread memory (store) into variable's master copy
|
| Lock
|
|
(thread tightly synchronized with main memory) causes a thread to acquire one claim on a particular lock
|
| Unlock
|
|
(thread tightly synchronized with main memory) causes a thread to release one claim on a particular lock
|