FileInputStream and FileOutputStream in Java - BunksAllowed

BunksAllowed is an effort to facilitate Self Learning process through the provision of quality tutorials.

Community

FileInputStream and FileOutputStream in Java

Share This

Source code
package com.t4b.test; import java.io.FileInputStream; import java.io.IOException; public class FileInputStreamTest { public static void main(String[] args) { FileInputStream fin; try { fin = new FileInputStream("test.txt"); int i = fin.read(); System.out.print((char) i); fin.close(); } catch (IOException e) { e.printStackTrace(); } } }


Source code
package com.t4b.test; import java.io.FileOutputStream; public class FileOutputStreamTest { public static void main(String args[]) { try { FileOutputStream fout = new FileOutputStream("test.txt"); fout.write(65); fout.write("Text".getBytes()); fout.close(); } catch (Exception e) { System.out.println(e); } } }

Happy Exploring!

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.