pulic class TestSqrt
{
public static void main(String[] args)
{
System.out.println("9的平方根是:"+Math.sqrt(9));
}
}
输出:3.0
Math类在java.lang包下,编译器默认是导入这个包中的所有类,所以无需导入,并且Math类中的方法全部是静态
pulic class TestSqrt
{
public static void main(String[] args)
{
System.out.println("9的平方根是:"+Math.sqrt(9));
}
}
输出:3.0
Math类在java.lang包下,编译器默认是导入这个包中的所有类,所以无需导入,并且Math类中的方法全部是静态