postheadericon Example of command line argument in Java

args.java

public class args
{
public static void main(String args[])
{
for(int i=0;i<args.length;i++)
{
System.out.println("argument[ "+i+" ] : "+args[i]);
}
}
}



This code demonstrate how to use command line argument in java programming

To execute this code


  1. Open  command prompt
  2. Compile args.java
    • javac args.java
  3. Execute AES.java
    • java args hi this is a demo code

0 comments:

Follow by Email

Blog Archive

Total Pageviews

© BipinRupadiya.com. Powered by Blogger.