Java examples for Language Basics:Math
Find power using Math.pow
public class Main { public static void main(String[] args) { //returns 2 raised to 2, i.e. 4 System.out.println(Math.pow(2,2)); /*from ww w. j a v a 2s .c om*/ //returns -3 raised to 2, i.e. 9 System.out.println(Math.pow(-3,2)); } }