In this tutorial we will learn writing Java Program to calculate Power of integer using POW() method.
POW() method in Java
java.lang.Math.pow() In java, pow() method takes two parameter as an input and return the calculated Power as an Output.
Math.pow(x, y) where x is base and y is exponent. so for the input pow(5,3) output will be 5*5*5= 125.
Java Program to calculate Power using POW() method
For the input from the user, the base number is 5, and the exponent number is 3. The ‘Math.pow(5, 3)’ will be 125, which is 6x6x6x6 i.e. 216.