Pages

JAVA INPUT STREAM


     This tutorial will show to you how to read user inputs when you creating a console applications. Most of the time in programming we need to get user inputs. So in JAVA simplest way to read user input is System.console().

   class test1
    {
        public static void main()
        {
           System.out.println("Type your name");
           String name = System.console().readLine();
           System.out.println("Your name is :"+name);
        }
    }

     You can successfully run this method in "command Line" in windows. But if you use IDE like "Eclipse", it will generate errors.