PROGRAM:
Program to show use of array.
/**
* @Prof. Jayesh
* Here an array variable a[], is printing its elements using for loop.
*/
public class ArrayProgram {
public static void main(String args[])
{
int a[]={1,2,3,4,5};
int i;
System.out.println(“Array members are: “);
for(i=0;i<5; i=i+1) 5>
{
System.out.println(a[i]);
}
}
}
OUTPUT:
Array members are:
1
2
3
4
5
Discussion
Ask a question, share your thoughts or report an error.
Sign in to participate in the discussion.
Join the discussion