Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

public class Main {

    public static void main(String args[]) {
        int i = 1;
        float f = 1.0f;
        long l = 1;
        double d = 1.0d;
        char c = 'a';
        boolean b = true;

        Object o = new String("Hello World");
        /* convert int to String */
        System.out.println(String.valueOf(i));
        /* convert float to String */
        System.out.println(String.valueOf(f));
        /* convert long to String */
        System.out.println(String.valueOf(l));
        /* convert double to String */
        System.out.println(String.valueOf(d));
        /* convert char to String */
        System.out.println(String.valueOf(c));
        /* convert boolean to String */
        System.out.println(String.valueOf(b));
        /* convert Object to String */
        System.out.println(String.valueOf(o));
    }
}

/*
1
1.0
1
1.0
a
true
Hello World
*/