MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

/*
 * Output:
true
A
500
40000
45.67
45.67
Hello
99
     
 */

import java.io.PrintWriter;

public class MainClass {

    public static void main(String args[]) {

        try {
            PrintWriter pw = new PrintWriter(System.out);

            // Experiment with some methods
            pw.println(true);
            pw.println('A');
            pw.println(500);
            pw.println(40000L);
            pw.println(45.67f);
            pw.println(45.67);
            pw.println("Hello");
            pw.println(new Integer("99"));

            // Close print writer
            pw.close();
        } catch (Exception e) {
            System.out.println("Exception: " + e);
        }
    }
}