Why the order of return type matters when we define a method in Java?
java, syntax
Solution
Because it is how it is designed.
Compiling isn't just magic. It parses the code and specific syntax has to be followed for it to properly interpret it.
Syntax is syntax and that's it.
Rules are made to be imposed. And syntax is a lot like rules. They've to be followed.
I can't get deep into this, like specifications as I'm no java coder. I code C#, but the above applies to most compiled languages.
Problem
``` public void static final finalMethod() { //This throws error saying "Syntax error on token //"void", volatile expected" } public static final void finalMethod() { } ``` works fine. Why the order plays an important role in defining a method? Why java expects the volatile keyword here?