Friday, 14 September 2012

Java program codes: 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]);
        }
    }

No comments:

Post a Comment