Java RandomAccessFile .writeDouble (double v)
Syntax
RandomAccessFile.writeDouble(double v) has the following syntax.
public final void writeDouble(double v) throws IOException
Example
In the following code shows how to use RandomAccessFile.writeDouble(double v) method.
//from ww w . j ava 2 s .c o m
import java.io.*;
public class Main {
public static void main(String[] args) {
try {
double d = 1234.5678;
RandomAccessFile raf = new RandomAccessFile("c:/test.txt", "rw");
raf.writeDouble(d);
raf.seek(0);
System.out.println(raf.readDouble());
raf.seek(0);
raf.writeDouble(123.4567);
raf.seek(0);
System.out.println(raf.readDouble());
raf.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »