I am new to Java. I am wondering if it is possible to call a synchronized method inside constructor. There is the example:
class a{
int a1;
public a(){
a1 = 1;
increment();
}
private synchronized void increment(){
a1++;
}
}
It is a toy example. I can just set the a1 to 2 at the constructor. I am just confused whether we can call increment() inside the constructor or not.