Character Stream I/O in Java

In a java programming, like a Byte stream Character stream is also used for input-output for 16 bit. But Byte streams are used to perform input and output of 8-bit.

Most common Character streams classes are, FileReader and FileWriter.

 FileReader- FileReader uses for reads two bytes at a time.

 FileWriter– FileWriter uses for writes two bytes at a time.

Example: Write a program, to copy the content of file A into file B using Byte stream class.

Note: if there is only file A in which data is written and no file B then, file B will be create automatically.

Suppose we have a File “A”

Hello students I am aditya.  

Output: When we run above program one new file create with Name “B” and content of file “A” will be copy into file “B”.

            File “B”

Hello students I am aditya.