Monday, September 13, 2010

How to make eclipse automatically add braces to an IF statement?

Programmer Question

In Java the following is completely valid:



if (x == null)
Y();
else
Z();


I personally don't like it at all. I like all my IF statements to have braces:



if (x == null) {
Y();
} else {
Z();
}


The eclipse formatter is wonderful and can beautify my code in many other ways. Is there a way to have it add the braces to IF statements?



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails