Rabu, 14 Maret 2012

Contoh Stream IO

Berikut Merupakan Contoh Penggunaan Stream IO

    Program dengan menggunakan class FileOutputStream untuk menulis File.
    Perhatikan bahwa menulis file dapat menyebabkan Exception, karena itu diperlukan penangkapan sinyal exception bila terjadi error.

Contoh Random Access File

public static void main(String[] args) throws IOException{
          File f = new File("test3.txt");
         if (!f.isFile() || !f.canRead() || !f.canWrite()) throw new
        IOException();
          RandomAccessFile raf = new RandomAccessFile(f, "rw");
}

==>Reblog from http://ninafauziah.blogspot.com
saTHREEa WirA