Curriculum
Course: Java Basic
Login

Curriculum

Java Basic

Java Home

0/1

Java Introduction

0/1

Java Get Started

0/1

Java Syntax

0/1

Java Comments

0/1

Java Type Casting

0/1

Java Operators

0/1

Java Booleans

0/1

Java Switch

0/1

Java Break / Continue

0/1

Java Errors and Exception

0/1
Text lesson

tan()

Example

Provide the tangent value for various angles.

System.out.println(Math.tan(0.5));
System.out.println(Math.tan(-0.5));
System.out.println(Math.tan(1));
System.out.println(Math.tan(-3));
System.out.println(Math.tan(Math.PI/4));

Definition and Usage

The tan() function yields the tangent of an angle.

Reminder: Angles are measured in radians.

Suggestion: Employ the constant Math.PI to represent angles as multiples or fractions of π.

Syntax

public static double tan(double angle)

Parameter Values

Parameter

Description

angle

Mandatory: Specify an angle in radians to calculate its tangent.

Technical Details

Returns:

A decimal value indicating the tangent of an angle.

Java Version:

1.5+