// Read array from keyboard
import java.util.*;
class ArrayTest
{
public static void main( String args[ ] )
{
Scanner sc = new Scanner( System.in );
int i;
int a[ ] = new int[5];
for( i=0 ; i<5 ; i++ )
{
System.out.print( "Enter Value : " );
a[ i ] = sc.nextInt();
}
System.out.print("\n Array elements are : ");
for( i=0 ; i<5 ; i++ )
{
System.out.print( " " + a[ i ] );
}
}
}
Output:
Enter Value : 10
Enter Value : 20
Enter Value : 30
Enter Value : 40
Enter Value : 50Array elements are : 10 20 30 40 50