1.

Explain the purpose of pow() method with the help of suitable java code. Also mention that pow() method belongs to which class?

Answer»

pow() method, a mathematical method, helps in calculating the power of any number.

For example:

int num=2,power=4;

int ans=Math.pow(num,power);

t1.setText(""+ans);

The above code will calculate the value of 24 and will give answer 16.

pow() method belongs to math class.



Discussion

No Comment Found

Related InterviewSolutions