Difference between int[] array and int array[]

前端 未结 25 2975
轻奢々
轻奢々 2020-11-21 07:18

I have recently been thinking about the difference between the two ways of defining an array:

  1. int[] array
  2. int array[]
  3. <
25条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-21 08:15

    when declaring a single array reference, there is not much difference between them. so the following two declarations are same.

    int a[];  // comfortable to programmers who migrated from C/C++
    int[] a;  // standard java notation 
    

    when declaring multiple array references, we can find difference between them. the following two statements mean same. in fact, it is up to the programmer which one is follow. but the standard java notation is recommended.

    int a[],b[],c[]; // three array references
    int[] a,b,c;  // three array references
    

提交回复
热议问题