WAP of array in Java

Free Java Programs

Write a program of array in Java

import java.io.*;
class arr
{
public static void main(String args[])throws IOException
{
int arr[] = new int[5];
int i;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the value");
for (i=0;i<5;i++)
{
String str= br.readLine();
arr[i]=Integer.parseInt(str);
}
System.out.println("The array is:");
for(i=0;i<5;i++)
System.out.println(arr[i]);
}
}

Post a Comment

Previous Post Next Post