dimanche 26 mai 2019

Java coding style 2019

I am curious to know the current coding style for java. My team is forcing to use {} for one liner if statements. Although we used to have braces for one liners current java source code does not use braces for one liner if statements anymore and I myself am inclined towards the same.

Python dropped braces altogether.

However I do not see any particular style guide in 2019.. The oracle doc still refers to the 1997 coding style.

What would be correct coding or is it something more to do with developer's preference?

   foo();

   if (condition)
      doSomething();

   bar();

vs

   foo();

   if (condition) {
      doSomething();
   }

   bar();

Aucun commentaire:

Enregistrer un commentaire