postheadericon Example of command line argument in 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
    • javac
  3. Execute
    • java args hi this is a demo code


Follow by Email

Blog Archive

Total Pageviews

© Powered by Blogger.