In the following code, which concept is demonstrated in the context of synchronization?
class Geeks {
private int counter = 0;
public synchronized void increment() {
counter++;
}
public synchronized int getCounter() {
return counter;
}
}
Use of Atomic class
Local framework synchronization
Synchronization on a method level
Usage of volatile keyword
This question is part of this quiz :
Java Deadlocks and Synchronization