+ 4

Please help! Why this programme prints 8. Thanks beforhend!

public class Program { public static void main(String[] args) { double p = Math.pow(2, 3); System.out.println(p); } } // 8

17th Dec 2017, 12:38 PM
Odil Mirsobirov
Odil Mirsobirov - avatar
4 Respostas
+ 5
In Math.pow() , the first parameter is the base and the second is the power you want to raise it by.
17th Dec 2017, 1:03 PM
Tarantino
Tarantino - avatar
+ 3
2^3 = 2 * 2 * 2 = 8
17th Dec 2017, 12:40 PM
john arnold barrozo
john arnold barrozo - avatar
+ 3
thanks!
20th Dec 2017, 2:43 PM
Odil Mirsobirov
Odil Mirsobirov - avatar
0
Shuniyam bilmisanmi Odil
2nd Feb 2019, 8:06 AM
Ibrohim
Ibrohim - avatar