What is the use of String args in Java?
I'll answer
Earn 20 gold coins for an accepted answer.20
Earn 20 gold coins for an accepted answer.
40more
40more
Studied at the University of California, Berkeley, Lives in Berkeley, CA, USA.
In Java 'args' contains the supplied command-line arguments as an array of String objects. In other words, if you run your program as 'java MyProgram abc xyz' then 'args' will contain ["abc", "xyz"]. When a java class is executed from the console, the main method is what is called.
2023-05-05 14:10:03
评论(499)
Helpful(122)
Helpful
Helpful(2)

Ethan Patel
QuesHub.com delivers expert answers and knowledge to you.
In Java 'args' contains the supplied command-line arguments as an array of String objects. In other words, if you run your program as 'java MyProgram abc xyz' then 'args' will contain ["abc", "xyz"]. When a java class is executed from the console, the main method is what is called.