欢迎您 本站地址:  
返回首页   返回编程教学   三字经  友情故事  俄罗斯方块  捕鱼游戏  少儿英语书籍  女生头像  学习CSS  学习Node.js 

Java pow() 方法

Java Number类Java Number类


pow() 方法用于返回第一个参数的第二个参数次方。

语法

double pow(double base, double exponent)

参数

返回值

返回第一个参数的第二个参数次方。

实例

实例

public class Test{
    public static void main(String args[]){
        double x = 11.635;
        double y = 2.76;

        System.out.printf("e 的值为 %.4f%n", Math.E);
        System.out.printf("pow(%.3f, %.3f) 为 %.3f%n", x, y, Math.pow(x, y));
    }
}

编译以上程序,输出结果为:

e 的值为 2.7183
pow(11.635, 2.760) 为 874.008

Java Number类Java Number类

小库提示

扫描下方二维码,访问手机版。