public class Passparam{ public static void main (String [] args) { System.out.println("Number of arguments passed are " + args.length); System.out.println("The First " + args[0]); System.out.println("The second " + args[1]); } }
Code:
java Passparam code miles
The output is :
Code:
Number of arguments passed are 2 The First code The second miles
You can change the name of parameter args ,but it must be of type String
_________________ M. S. Rakha, Ph.D. Queen's University Canada