+ 6

The syntax is confusing abit public static void main(String[ ] args)

The square brackets, are they supposed to be before the args or after it, because in some other tutorials, they are placed after the args, but here in sololearn, they are placed before.

23rd Apr 2020, 7:52 AM
Alfred Juma
Alfred Juma - avatar
4 Respuestas
+ 8
String [] args; It 's an array declaration Here "String" is a variable datatype and "args" is variable name. You can use square brackets before variable name of an array or you can use after the the name of an array.
23rd Apr 2020, 8:02 AM
Arafat Hossain Ar
Arafat Hossain Ar - avatar
+ 9
As you know (String[] args) is an array of strings , String is the datatype and args is the name of the array . In Java we can use square brackets with the array name or with the array type . But in other languages like c# it's not possible
23rd Apr 2020, 8:09 AM
Joobin Jacob ◆ ܝܘܼܒܝܼܢ ܝܹܩܲܒ ◆‎
+ 5
Alfred Juma Welcome. 😊
23rd Apr 2020, 8:08 AM
Arafat Hossain Ar
Arafat Hossain Ar - avatar
+ 3
Thanks Arafat Hossain Ar , big help man
23rd Apr 2020, 8:06 AM
Alfred Juma
Alfred Juma - avatar