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) {

        StringWriter sw = new StringWriter();

        // create a new sequence
        String s = "Hello from java2s.com";

        // write a string
        sw.write(s);

        System.out.println(sw.toString());

        try {
            // close the writer
            sw.close();
        } catch (IOException ex) {
            ex.printStackTrace();
            ;
        }

    }
}