Menu
Question Index
...

What will be the output of the following program?

public class Absolute{
    public static void main(String[] args) {
        int i = 12;
        double l = -10.01;
        double d = 95.530;
        float f = 0.6201f;
        System.out.print("i: " + Math.abs(i));
        System.out.print(" s: " + Math.abs(l));
        System.out.print(" d: " + Math.abs(d));
        System.out.print(" f: " + Math.abs(f));
    }
}


i: 12 s: -10.01 d: 95.53 f: 0.62
i: 12 s: 10.01 d: 95.53 f: 0.6201
i: 12 s: 10 d: 95.53 f: 0.62
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