MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

strictfp class MainClass {
    public static void main(String[] args) {
        // Display the square root of 2 using sqrt()
        System.out.print("sqrt(2.0) = ");
        System.out.println(Math.sqrt(2.0));
        // Calculate and display using pow()
        System.out.print("pow(2.0, 0.5) = ");
        System.out.println(Math.pow(2.0, 0.5));
        System.out.println();
    }
}