问题
单项选择题
下列哪个选项是正确计算角度42°的余弦值( )
A.double d = Math. cos(42);
B.double d = Math. cosine(42);
C.double d = Math. cos(Math. toRadians(42));
D.double d = Math. cos(Math. toDegrees(42));
答案
参考答案:C
解析: public static double cos(double a)是Math类中返回以弧度为单位的a的余弦值的,应先用toRadians()方法将42°转换为弧度值。