0
Why we write int[] NUM; not int NUM[] in java????
Java programming,array declaration
2 Antworten
+ 3
Java has the syntax rule <modifier> <type> <name> [<assignments>].
+ 1
Because it is clearer that int[] is a type and num is a name.
But if you are more comfortable writing int [] (eg if you know better C language) it is possible. Sometimes it is also useful in java.
int[] a = {1,2,3};
int b[] = {1,2,3};
int i=0, c[]={1,2,3};