32 lines
647 B
Plaintext
32 lines
647 B
Plaintext
According to the Java Language Specification:
|
|
|
|
|
|
____
|
|
For compatibility with older versions of the Java SE platform,
|
|
|
|
the declaration of a method that returns an array is allowed to place (some or all of) the empty bracket pairs that form the declaration of the array type after the formal parameter list.
|
|
|
|
This obsolescent syntax should not be used in new code.
|
|
|
|
____
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
public int getVector()[] { /* ... */ } // Noncompliant
|
|
|
|
public int[] getMatrix()[] { /* ... */ } // Noncompliant
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
public int[] getVector() { /* ... */ }
|
|
|
|
public int[][] getMatrix() { /* ... */ }
|
|
----
|
|
|
|
|