开发者

Array declaration in Java [duplicate]

This question already has answers here: 开发者_如何学运维 Closed 10 years ago.

Possible Duplicate:

Difference between int[] array and int array[]

Is int[] arr; functionally the same as int arr[];?


Yes. You can put the braces in either place when declaring an array.

Bonus: you can even put 'em here: int []arr


Yes, the functionality is the same. You can have the braces anywhere.

int[] a,b,c[];

is equivalent to

int a[],b[],c[][];


It's just the matter of style. You can pick the style you like. They perform exactly the same. Some claim that if you write "int[] array", it will be clearer that it's an array of integer rather than writing "int array[]".


It is, it's just to appease C++ developers they include int arr[]. (Or at least what I told in school)


Yes it's the same. int[] arr is more convenient though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜