In this example we will show how to calculate trigonometric tangent of an angle with Math.tan()
in Java.
Source Code
package com.beginner.examples;
public class TangentExample {
public static void main(String[] args){
//return the trigonometric tangent value of an angle.
System.out.println("tan(45) is: "+Math.tan(45));
System.out.println("tan(60) is: "+Math.tan(60));
}
}
Output:
tan(45) is: 1.6197751905438615
tan(60) is: 0.320040389379563