Logo 
Search:

Java Articles

Submit Article
Home » Articles » Java » Homework HelpRSS Feeds

Program to read input from the Standard Input Device

Posted By: Stephanie Mitchell     Category: Java     Views: 2876

A Java Program to read input from the Standard Input Device.

Code for Program to read input from the Standard Input Device in Java

import java.io.*;

 publicclass JAVA_005
 {

    publicstaticvoid main(String[] args)
    {
       DataInputStream Input=new DataInputStream(System.in);

       String N;
       String Str;

       try
          {
             System.out.println("Enter an integer value : ");

             N=Input.readLine( );

             System.out.println("Enter a string value : ");

             Str=Input.readLine( );

             int n=Integer.parseInt(N);

             System.out.println("\nThe integer value is : " + n);
             System.out.println("\nThe string value is : " + Str);
          }

        catch(IOException e)
          {
             System.err.println(e);
          }
    }
 }
  
Share: 


Didn't find what you were looking for? Find more on Program to read input from the Standard Input Device Or get search suggestion and latest updates.

Stephanie Mitchell
Stephanie Mitchell author of Program to read input from the Standard Input Device is from Seattle, United States.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!