Why brackets are necessary in catch block in java?

Viewed 2690

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.

7 Answers
Related