Search Here

Java program for Command-line Argument Passing


/* Commandline argument passing */

import java.io.*;
class Main
{
 public static void main(String args[])
 {
  int len = args.length;
  if(len > 0)   
   for(int i=0; i < len; i++) 
    System.out.println("Argument "+(i+1)+": "+args[i]);
  else
   System.out.println("No argument given!");  
 }
}

No comments:

Post a Comment