In the following code, which concept is demonstrated in the context of synchronization?

Last Updated :
Discuss
Comments

In the following code, which concept is demonstrated in the context of synchronization?

Java
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

Share your thoughts in the comments