Search This Blog

Monday, September 3, 2012

Program to accept 5 strings on Terminal window

/*
 * Program to accept 5 strings on Terminal window
 */

import java.io.*;
public class yps1
{
    public static void main(String args[]) throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String name[]=new String[5];
        int i,j;
        System.out.println("Enter five names");
        for(i=0; i<5; i++)
        {
           
            name[i]=br.readLine();
           
        }
        for(j=0; j<5; j++)
        {
           
            System.out.println("NAME  "+ (j+1) + " :"+ name[j]);           
        }
       
    }
}

2 comments: