Placing the array designators []
after the type helps maintain backward compatibility with older versions of the Java SE platform.
This syntax contributes to better readability as it becomes easier to distinguish between array types and non-array types. It helps convey the
intention of the method to both the developer implementing it and the developer using it.
public class Cube { private int magicNumbers[] = { 42 }; // Noncompliant public int getVector()[] { /* ... */ } // Noncompliant public int[] getMatrix()[] { /* ... */ } // Noncompliant }
public class Cube { private int[] magicNumbers = { 42 }; // Compliant public int[] getVector() { /* ... */ } // Compliant public int[][] getMatrix() { /* ... */ } // Compliant }