+ 4
[DUPLICATE] What is the Difference between main(String[] args) and main(String args[]) ?
I have seen that some programers write in both ways, but I want to know the difference and why you can write it in both ways without an error appear.
5 Answers
+ 19
No difference at all, just preference. You can even write it (String []args) if you wanted. This is because of how the language was designed. It is usually best practice to do String[] args though. This follows standard array declaration like int[] x. Doing int x[] would only be done if you're creating several int variables but only 1 is an array. Like int x, y[], z; Creates three variables of int, x y and z, but only y is an array.
+ 1
there is no difference between these two...we can write in any of these two ways
0
i guess it s the same thing
0
both are same it's array declaration of type string with the name args you are allowed to change the name args as : argu, arr, array, etc whatever you want because it's just a name of an array of type string
0
learn about array to make you understand it clearly