Why Sin(30) = -0.9880316240928618 in java

I try to show the value of sin 30 in java (eclipse). But it's not a real value, My code :

public class sin30 {
public static void main(String[] args){

    System.out.println("Sin 30 = "+Math.sin(30));


and show : Showing

should sin 30 is 0.5. what's wrong with my code?


  • Before, you should transform it to radians like this:

      double radians = Math.toRadians(30);
      System.out.println("Sin 30 = "+Math.sin(radians));