How to pass command line arguments in Java?

Hi,

In a Java program I have to write for reading the command line arguments and use it in a programming.

How to pass command line arguments in Java?

Share me the sample code.

Thanks

View Answers

April 16, 2017 at 6:12 PM

Hi,

You can use the String[] args of the main function in Java.

Then use can use the the index number for example 0 for getting the data of the 0 position.

e.g:

args[0]

Passing Command Line Arguments.

Thanks









Related Tutorials/Questions & Answers:
Advertisements