0
public static void main(String args[])
0 I have noticed in Java some variation of the beginning code. In some places I see: public static void main(String args[]) In other places I see: public static void main(String[] args) What is the difference between one and the other?
2 ответов
+ 1
both are correct, but square brackets after the data type is preferred. I guess it increases readability.
+ 4
Java supports the syntax of square brackets being written after the array identifier as a legacy syntax from C, for C programmers to better adapt to Java when porting over.
The latter (square brackets after type) is preferred in Java.