+ 1

What does *String[] args* mean after main method?

7th Aug 2018, 5:12 AM
Kavya R
Kavya R - avatar
2 Réponses
+ 1
Those are for command-line arguments in Java. In other words, if you run your java program 'MyProgram' with additional values 'one' and 'two'. As follows, java MyProgram one two Then args contains: [ "one", "two" ] public static void main(String [] args) { String one = args[0]; //contains "one" String two = args[1]; //contains "two" } The reason for this is to configure your application to run a particular way or provide it with some piece of information it needs.
7th Aug 2018, 5:44 AM
Nadun Kulatunge
Nadun Kulatunge - avatar
0
it is used to take arguments from the command prompt or take the values in runtime
7th Aug 2018, 5:15 AM
PRAMOD JANA
PRAMOD JANA - avatar