+ 1

Why do we include arguments in the main() method inside a class?

1st Jul 2017, 7:11 PM
Divya Vishwakarma
Divya Vishwakarma - avatar
4 Answers
+ 1
But what's the sense of including parameters. I am asking what if Javasoft would have made the main() without String [] args,then what had happened?
2nd Jul 2017, 3:15 AM
Divya Vishwakarma
Divya Vishwakarma - avatar
+ 1
Thommy could u please tell me that what are input switches.
2nd Jul 2017, 11:59 AM
Divya Vishwakarma
Divya Vishwakarma - avatar
0
I suppose you are talking about (String[] args)? Those are used to catch switches when starting your program. For example you could attach -h or --help to display a help text when running your program.
1st Jul 2017, 7:51 PM
Thommy Berglund
Thommy Berglund - avatar
0
Then we would need a different way to receive input switches to our programs.
2nd Jul 2017, 9:11 AM
Thommy Berglund
Thommy Berglund - avatar