Java Math tan() Method

The tan() method of Java Math class returns the trigonometric tangent of the specified angle.

Syntax:

public static double tan(double a)

Parameters:

The parameter ‘a’ represents an angle measured in radians.

Return Value:

The tan() method returns the tangent of the argument.

  • It returns zero with same sign as argument, if the argument passed is zero.
  • It returns NaN, if the argument is NaN or infinity.

Example 1:

Output:

Example 2:

Output:

Example 3:

Output:

Example 4:

Output:

Example 5:

Output: