Write a program in java to demonstrate one dimensional array?

import java.util.Scanner;

class Array1

{

                public static void main(String arg[])

                {

                                Scanner in=new Scanner(System.in);

                                int a[]=new int[10];

                                System.out.print("Enter Array Size ");

                                int s=in.nextInt();

                                System.out.println("Enter Array ");

                                for(int i=0;i<s;i++)

                                                a[i]=in.nextInt();

                                System.out.println("Your Data ");

                                for(int i=0;i<s;i++)

                                                System.out.println(a[i]);

                }

}

One Dimensional Array.PNG

, , , , , , , ,

Leave a Reply