public class SanJiao {
public static void main(String[] args) {
double a = Math.toRadians(90);//把数字90 转换成 90度
System.out.println(Math.sin(a));//计算sin 90度
double b = Math.toRadians(30);
System.out.println(Math.cos(b));
double c = Math.toRadians(20);
System.out.println(Math.tan(c));
}
}
运行输出
1.0
0.8660254037844387
0.36397023426620234
你好, java基础包下的Math类有对应的静态方法:
Math.cos(a)
Math.sin(a)
Math.tan(a)
java.lang.Math类里面有对应的方法
sin(double a)
Math类中有
~
~
~