+ 2
Parameter of main method
why the parameter of main method is an argument of strings and not anything else?
4 Réponses
+ 18
then its ok ☺
//try making codes also on concepts u learn (can keep them private) , u will learn more faster
+ 4
Because when you run a Java program from the command-line, the command you use looks like this:
java nameoffilehere arg0 arg1 arg2...
The arg0, arg1, and arg2 are the 0, 1, and 2 indices of the String[] args in the main method. You can use them in your program.
Also, args is just a convention, it doesn't have to be named args to function.
+ 2
no no.... it's nothing of that sort.... I am just trying to clear the doubts.... as soon as they pop up in my mind..... so that to learn and understand things rather to cram them up
+ 2
Hope it's not bothering you :)@Gaurav