-
-
Save donhuvy/94dc3edd94890b87721f1530b115976b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Test { | |
int count; | |
synchronized void bump() { | |
count++; | |
} | |
static int classCount; | |
static synchronized void classBump() { | |
classCount++; | |
} | |
} | |
class BumpTest { | |
int count; | |
void bump() { | |
synchronized (this) { | |
count++; | |
} | |
} | |
static int classCount; | |
static void classBump() { | |
try { | |
synchronized (Class.forName("BumpTest")) { | |
classCount++; | |
} | |
} catch (ClassNotFoundException e) { | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment