每日总结

在复习完类后,继续进行了Java中方法的复习。

Java中的方法其实就是C语言中的函数,只不过是名字不同。

Java中的方法分为:类方法、实例方法和构造方法。

下面是一些数学运算方法的实例:

public class TestMath
{
public static void main(String[] args)
{
/*---------下面是三角运算---------*/
//将弧度转换角度
System.out.println("Math.toDegrees(1.57):" + Math.toDegrees(1.57));
//将角度转换为弧度
System.out.println("Math.toRadians(90):" + Math.toRadians(90));
//计算反余弦,返回的角度范围在 0.0 到 pi 之间。
System.out.println("Math.acos(0.3):" + Math.acos(1.2));

}

原文地址:https://www.cnblogs.com/lxywsx/p/14175117.html