First Array Program in Java

import java.util.*;

public class FirstArray
{
    public static void main(String[] args)
    {
        int ar[] = new int[10];
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < 10; i++)
        {
            System.out.print("Enter the number ar[" + i + "]:");
            ar[i] = sc.nextInt();
        }
        System.out.println("The numbers are:");
        for (int i = 0; i < 10; i++)
        {
            System.out.println("ar[" + i + "]:" + ar[i]);
        }
    }
}


Output:

Enter the number ar[0]:5
Enter the number ar[1]:4
Enter the number ar[2]:2
Enter the number ar[3]:11
Enter the number ar[4]:32
Enter the number ar[5]:56
Enter the number ar[6]:14
Enter the number ar[7]:32
Enter the number ar[8]:14
Enter the number ar[9]:58
The numbers are:
ar[0]:5
ar[1]:4
ar[2]:2
ar[3]:11
ar[4]:32
ar[5]:56
ar[6]:14
ar[7]:32
ar[8]:14
ar[9]:58
java java tutorials learn java study java