0

Why we write int[] NUM; not int NUM[] in java????

Java programming,array declaration

6th Aug 2020, 10:57 AM
BHARAT BORUDE
BHARAT BORUDE - avatar
2 Antworten
+ 3
Java has the syntax rule <modifier> <type> <name> [<assignments>].
6th Aug 2020, 11:03 AM
Sandra Meyer
Sandra Meyer - avatar
+ 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};
8th Aug 2020, 1:32 PM
zemiak