In java if we have to execute only one statement after if or for the brackets are not necessary. We can write:
if(condition)
executeSingleStatement();
or
for(init;condition;incr)
executeSingleStatement();
But in the case of catch block why we can not omit the brackets? Why this is not possible?
catch(Exception e)
e.printStackTrace();
Because in most of the case we I have only one statement in catch block which is either e.printStackTrace() while testing or logging statement.
It’s not an issue of possible or impossible. It’s just a language (syntax) design decision.
There are several implementation of Java language parser. One could modify the parser source less than a day and allow no-bracket-enclosed catch statements.
http://www.google.com/search?q=java+parser
Also note Java language grammar.