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 {
            long f = 123456789909876L;

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

            raf.writeLong(f);

            raf.seek(0);

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

            raf.seek(0);

            raf.writeLong(20000000000l);

            raf.seek(0);

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

    }
}