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 i = 70;

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

            raf.writeChar(i);

            raf.seek(0);

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

            raf.seek(0);

            raf.writeChar(71);

            raf.seek(0);

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

    }
}