Java Programing laungage

Java Input Output Projects

Java I/O Project 1

Java Input Output Examples

Java Input Output Examples

Standard Stream

It is a feature of the operating system. in which they read input from the keyboard and write to display.

Previous Home Next

It is also support input and output on file system. and this feature is controlled by command line interpreter.

In java there are three standard stream support. first Standard Input, it is access through System.in. and second is Standard Output, it is access through System.out. and third is Standard error, which is access through System.err. these objects are defined automatically and never need to open this objects.

  1. Standard Input

    Inherited through System.in and this is used to read input from the keyboard.

  2. Standard Output

    Inherited through System.out and this is used to write output to be display.

  3. Standard Error

    Inherited through System.err and this is used to write error output to be display.

The System.in has a byte stream feature. for using this stream we are wrap the System.in into InputStreamReader by which it is behave as a character stream.


InputStreamReader isr=new InputStreamReader(System.in);

Example


import java.io.*;
public class readIO{
public static void main(String args[])throws IOException{
InputStreamReader isr=new InputStreamReader(System.in)
BufferedReader br=new BufferedReader(isr);
System.out.println("enter the text");
String str=in.ReadLine();
System.out.println("your enter string"+str);
}
}

Previous Home Next