Java Reference
In-Depth Information
8.4.3.5. strictfp Methods
The effect of the
strictfp
modifier is to make all
float
or
double
expressions within the method
8.4.3.6. synchronized Methods
For a class (
static
) method, the monitor associated with the
Class
object for the method's class
is used.
For an instance method, the monitor associated with
this
(the object for which the method
was invoked) is used.
Example 8.4.3.6-1.
synchronized
Monitors
Thus, the code:
class Test {
int count;
synchronized void bump() {
count++;
}
static int classCount;
static synchronized void classBump() {
classCount++;
}
}
has exactly the same effect as:
class BumpTest {
int count;
void bump() {
synchronized (this) { count++; }
}
static int classCount;
static void classBump() {
try {
synchronized (Class.forName("BumpTest")) {
classCount++;