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 {
            int f = 1234;

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

            raf.writeInt(f);

            raf.seek(0);

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

            raf.seek(0);

            raf.writeInt(200);

            raf.seek(0);

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

    }
}