Hi,
I have never used RAF before and am stuck again. Help needed! Please see the codes below:
import java.io.*;
public class RandomPractice
{
// RandomAccessFile r1=new RandomAccessFile("d:\\temp", "rw");
//Q1:The program will not compile with the line above, no idea
//about how to handle it.
public static void main(
String[] afg) throws IOException {
File f=new File("d:\\java2-certificate/access2.doc");
RandomAccessFile r4=new RandomAccessFile(f, "rw");
r4.writeBytes("test-writeByte");
//so far, everything is fine
System.out.println("output of readByte()is "+r4.readByte());
//Q2: No problem in compiling, but I got errors in running time.
//NO idea about what is going on?
//Q3: Can someone tell me how how to use method writebyte(int b)?
}
}
Thanks a lot
Ben