Wednesday, March 09, 2005

static Fields

Program

class JavaApplication {
    public static void main(String[] args) {
        // e, the base of the natural logarithms
        System.out.println(Math.E);

        // pi, the ratio of the circumference of a circle to its diameter
        System.out.println(Math.PI);
    }
}

Output

[user]$ javac JavaApplication.java
[user]$ java JavaApplication
2.718281828459045
3.141592653589793

No comments: