
java program using inputstream and outputstream

Hi Friend,
Try the following code:
import java.io.*;
class InputStreamAndOutputStream
{
public static void main(String[] args)throws Exception{
InputStream in = new FileInputStream("C:/Hello.txt" );
OutputStream out = System.out;
int nextChar;
while ( ( nextChar = in.read() ) != -1 )
out.write((char) nextChar );
out.write('\n' );
out.flush();
}
}
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.