Home » Java Math.sin() Method with Examples

Java Math.sin() Method with Examples

by Online Tutorials Library

Java Math.sin() method

The java.lang.Math.sin() is used to return the trigonometric sine of an angle. This method returns value between -1 to 1.

Syntax

Parameter

Return

  • If the argument is positive or negative number, this method will return the Sine value.
  • If the argument is NaN or infinity, this method will return NaN.
  • If the argument is zero, this method will return zero with the same sign as the argument.

Example 1

Test it Now

Output:

0.8660254037844386  

Example 2

Test it Now

Output:

1.0  

Example 3

Test it Now

Output:

NaN  

Example 4

Test it Now

Output:

-0.9285211870146288  

Next TopicJava Math

You may also like