Tuesday, 25 November 2014

Hey friends, this is an example of a simple java program which takes an input from the user.


import java.io.*;

class Register
{

       public static void main(String args[]) throws IOException
      {
               InputStreamReader isr= new InputStreamReader(System.in);
               BufferedReader br=new BufferedReader(isr);

                System.out.println("Enter a string");
                String input-br.readLine();

                System.out.println("You entered: "+input);
     }

}

                

No comments:

Post a Comment