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

        double x = 45.0;
        double y = 180.0;

        // convert them to radians
        x = Math.toRadians(x);
        y = Math.toRadians(y);

        // calculate their cosine
        System.out.println("Math.cos(" + x + ")=" + Math.cos(x));
        System.out.println("Math.cos(" + y + ")=" + Math.cos(y));

    }
}