I am learning java programming language. Right now I have little bit knowledge of JAVA. I want to know how command line arguments are passed in Java. If you are having any info then reply me. It can helpful to me. Thanks in advanced.
I am learning java programming language. Right now I have little bit knowledge of JAVA. I want to know how command line arguments are passed in Java. If you are having any info then reply me. It can helpful to me. Thanks in advanced.
Try to understand following example which is helpful for you. Refer following program to Command-Line Arguments in Java:
Code:public class CmdArgsDemo{ public static void main(String[] args){ System.out.println("The following command line arguments were passed:"); for (int i=0; i < args.length; i++){ System.out.println("arg[" + i + "]: " + args[i]); } } }
You will have to enter the command-line arguments when include the application. For example suppose a Java application called Align sorts lines in a file. To sort the data in a file named test.txt, a user would enter:
When an application is run, the runtime system passes the command-line arguments to the application's main method through an array of Strings.Code:java Align test.txt
Bookmarks