Friday, April 6, 2018

Array Input Output of Java

/* Assigning value to array elements through keyboard */
package webpractrice;

import java.io.*;
public class WebPractrice

    public static void main(String[] args) throws IOException
    {
        int Roll[] = new int [5];
        String S[] = new String[5];
        for (int i = 0; i < 5; i++)
        {
            System.out.print("\nEnter Your ID [" +i +"] : ");
            BufferedReader BR = new BufferedReader(new InputStreamReader(System.in));
            S[i] = BR.readLine();
            Roll[i] = Integer.parseInt(S[i]);
        }
        for(int i = 0; i < 5; i++)
        {
            System.out.println("\nID[" +i+ "] = "+Roll[i]);
        }
    }
   
}









Share:

0 comments:

Post a Comment

Blogger templates