Java Math pow() Method
Example
Raise different numbers to different powers:
System.out.println(Math.pow(2, 8));
System.out.println(Math.pow(3, 4));
System.out.println(Math.pow(9, 0.5));
System.out.println(Math.pow(8, -1));
System.out.println(Math.pow(10, -2));
Definition and Usage
The pow() method raises a number to the power of another number.
Syntax
public static double pow(double base, double exponent)
Parameter Values
| Parameter | Description |
|---|---|
| base | Required. The base of the operation. |
| exponent | Required. The exponent of the operation. |
Technical Details
| Returns: | A double value representing the result of the base to the power of the exponent. |
|---|---|
| Java version: | Any |
❮ Math Methods