In a mock exam question I thought that this was a good declaration of a method:
public void synchronized amethod3(){ }
I saw I was wrong when I review the answer. But the exact reason is not 100% clear to me. Doing some
testing I think you can mix the order of all modifiers (access modiefiers, abstract, synchronized) but the return type of the method must be placed directly before the methods name. Is that correct?
Here is my test program I tried to compile:
class test {
public synchronized void amethod1(){ }
synchronized public void amethod2(){ }
public void synchronized amethod3(){ } // does not compile
void public amethod4(){} // does not compile
void public abstract amethod5(); // does not compile
}