Cara Membuat Metode Thread Aman di Java

class MyCounter {
	private static int counter = 0;
 
	public static synchronized int getCount() {
		return counter++;
	}
}
Condemned Crane