0

String[ ] object in main method

I am newbie in JAVA, i just curious why we must always pas String[ ] object in main method

13th Dec 2016, 9:13 AM
Hidayat Taufiq
Hidayat Taufiq - avatar
3 Respostas
0
It's because the main method is a normal method, and can be used with arguments. This String object is the array which can contains arguments
13th Dec 2016, 9:15 AM
Jikar
Jikar - avatar
0
i see, but actually i never pass any parameter within main method. But if i remove String [ ], it would be return error message when i run the program. FYI , i use Intelij IDEA as IDE.
13th Dec 2016, 9:19 AM
Hidayat Taufiq
Hidayat Taufiq - avatar
0
I don't know i never tried to remove it, you can test that, but to my mind it's not a good idea, you never know maybe you will need to use arguments, as your code will change
13th Dec 2016, 9:23 AM
Jikar
Jikar - avatar