Menu
Question Index
...

What will be the output of the following program?

public class Root {
    public static void main(String[] args) {
        int x = 4;
        int y = 9;
        System.out.println(Math.sqrt(x) + " " + Math.sqrt(y));
        int sum = (int) (Math.sqrt(x) + Math.sqrt(y));
        System.out.println(sum);
    }
}


2 3
5
2.0 3.0
5
Compilation Error
Runtime Error

Doubts

Problems

Topic: Java Math Class - java.lang.Math

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App