sin() Method in java

Java Programming Language / Number Class in java

878

Program:

 public class WrappersinMethod {

    public static void main(String args[]) {
	      double degrees = 45.0;
	      double radians = Math.toRadians(degrees);

	      System.out.format("The value of pi is %.4f%n", Math.PI);
          System.out.format("The sine of %.1f degrees is %.4f%n", degrees, Math.sin(radians));
	   }
}


/*

Returns the sine of the specified double value.

*/

Output:

The value of pi is 3.1416
The sine of 45.0 degrees is 0.7071
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.