Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.*;

public class Main {

    public static void main(String[] args) {
        try {
            float f = 1234.5678f;

            RandomAccessFile raf = new RandomAccessFile("c:/test.txt", "rw");

            raf.writeFloat(f);

            raf.seek(0);

            System.out.println(raf.readFloat());

            raf.seek(0);

            raf.writeFloat(123.4567f);

            raf.seek(0);

            System.out.println(raf.readFloat());
            raf.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }

    }
}