Menu
Question Index
...

What will be the output of the following program?

public class Conversions {
    public static void main(String args[]) {
        int cat = 15;
        String dog = Integer.toBinaryString(cat);
        String monkey = Integer.toOctalString(cat);
        String cow = Integer.toHexString(cat);
        System.out.print(dog + " " + monkey + " " + cow);
    }
}


1111 17 f
1111 15 f
1111 017 f
1111 15 g
Compilation Error or Runtime Error

Doubts

Problems

Topic: Converting Numbers to and from Strings In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App