Saturday, 10 September 2011

Array :: Entering values through key board in java

    import java.util.*;
    public class Array
    {
        public static void main(String args[])
        {
            int[] a=new int[6];
            Scanner sc=new Scanner(System.in);
            System.out.println("Please enter elements...");
            for(int j=0;j<6;j++)
                a[j]=sc.nextInt();
            System.out.println("Array elements are : ");
            for (int i=0;i<a.length;i++)
                System.out.println(a[i]);
        }
    }

1 comment:

Vinumj said...

how to get string from the user