Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.BufferedOutputStream;
import java.io.DataOutputStream;
import java.io.FileOutputStream;

public class Main {
    public static void main(String[] argv) throws Exception {
        FileOutputStream fileOut = new FileOutputStream("data.txt");
        BufferedOutputStream buffer = new BufferedOutputStream(fileOut);
        DataOutputStream dataOut = new DataOutputStream(buffer);
        dataOut.writeUTF("Hello!");
        dataOut.writeInt(4);
        dataOut.writeDouble(100.0);
        dataOut.close();
        buffer.close();
        fileOut.close();
    }
}