Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.Arrays;

public class Main {
    public static void main(String args[]) throws Exception {
        String[] words = { "", "e", "a", "c" };
        Writer w = new BufferedWriter(new OutputStreamWriter(System.out, "Cp850"));
        for (int i = 0; i < 4; i++) {
            w.write(words[i] + " ");
        }
        Arrays.sort(words);
        for (int i = 0; i < 4; i++) {
            w.write(words[i] + " ");
        }
        w.flush();
        w.close();
    }
}