Why we are passing String[] in main function in java..? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Why we are passing String[] in main function in java..?

Help me out of this!!

10th Apr 2019, 6:39 AM
Syntax_error_chaitu
Syntax_error_chaitu - avatar
3 Answers
+ 4
The command line arguments are an array of strings with the first element being the name of the program.
10th Apr 2019, 2:35 PM
Sonic
Sonic - avatar
+ 3
It is called the command line arguments .. They are the parts which are required for your program execution. For example if you want to print "hello world", it is passed as one of the arguments. And it seems that commands in the command line accept only string arguments .. And it's an array because other Collections didn't exist in java 1
10th Apr 2019, 7:00 AM
Afnan A.
Afnan A. - avatar
+ 2
Yeah got it.. thanks
10th Apr 2019, 7:03 AM
Syntax_error_chaitu
Syntax_error_chaitu - avatar