Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
    // CORRECT: A public class definition
    public class MyClass {
      ...
    }

    // WRONG:
    public class MyClass
    {
      ...
    }

    // WRONG:
    public class MyClass {
      ...
      }

    // CORRECT: A method definition
    void method(int j) {
      ...
    }
    
    // CORRECT: A do/while
    do {
      ...
    } while (...)

 


Eclipse and IntelliJ formatter settings

...

Avoid using reformatting commands for an entire file while changing a part of the file. Especially for an existing file as it makes it difficult to know the exact difference by comparing revisions.

Line Separator

Use java.lang.System.lineSeparator() instead of java.lang.System.getProperty("line.separator").