Question
class Output {
public static void main(String args[]) {
double x = 2.0;
double y = 3.0;
double z = Math.pow( x, y );
System.out.print(z);
}
}
What is the output of this program?
class Output {
public static void main(String args[]) {
double x = 2.0;
double y = 3.0;
double z = Math.pow( x, y );
System.out.print(z);
}
}
Answer: Option C
Was this answer helpful ?
Math.pow(x, y) methods returns value of y to the power x, i:e x ^ y, 2.0 ^ 3.0 = 8.0.
Output:
$ javac Output.java
$ java Output
8.0
Was this answer helpful ?
Submit Solution