Menu
Question Index
...

What will be the output of the following program?

public class AbsoluteMethod {
    public static void main(String[] args) {
        int i = 12;
        long l = -10;
        double d = 95.53;
        float f = 0.62f;
        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 d: 95.53 f: 0.62
i: 12 s: -10 d: 95.5 f: 0.6
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