Java .sin()
Published Dec 17, 2022
Contribute to Docs
The Math.sin() method returns the trigonometric sine of an angle argument, given in radians.
Syntax
Math.sin(angle)
The angle parameter is expressed in radians.
- The result is in the range [-1, 1].
- If the
angleisNaNor infinity,NaNis returned.
Example
The following example demonstrates the application of .sin() method:
// Check.javapublic class Check {public static void main(String args[]) {// convert degrees to radiansdouble pi = Math.PI;double degree = 60;double radian = degree * pi/180;System.out.println( "Sine of 60 degrees is " + Math.sin(radian));}}
This results in the following output:
Sine of 60 degrees is 0.866025
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Java on Codecademy
- Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
- Includes 6 Courses
- With Professional Certification
- Beginner Friendly.75 hours
- Learn to code in Java — a robust programming language used to create software, web and mobile apps, and more.
- Beginner Friendly.17 hours