Java array convention: String[] args vs. String args[]

后端 未结 4 1771
孤城傲影
孤城傲影 2020-12-08 20:49

I am currently teaching students as a tutor programming conventions. I\'ve told them that they can find most conventions in the Oracle Code Conventions.

In my last

4条回答
  •  鱼传尺愫
    2020-12-08 21:07

    This is not from Oracle but I think it will help.

    It is from Kathy Sierra's book SCJP Sun Certified Programmer for Java 6

    int[] key;
    int key [];
    

    When declaring an array reference, you should always put the array brackets immediately after the declared type, rather than after the identifier (variable name). That way, anyone reading the code can easily tell that, for example, key is a reference to an int array object, and not an int primitive.

提交回复
热议问题