Java Program to initialize an array with values passed from command line…

This java program is to initialize an array with values passed from command line.
import java.io.*;
class Arr3
{
                public static void main(String args[])throws IOException
                {
                                int n;
                                n=args.length;
                                int a[]=new int[n];
                                int i;
                                for(i=0;i
                                {
                                                a[i]=Integer.parseInt(args[i]);
                                                System.out.println(a[i]);
                                }
                               
                }

}

Add Comment