Menu
Question Index
...

What will be the output of the following program?

public class PrintStatment10
{
    public static void main(String args[])
    {
        PrintStatment10 obj = new PrintStatment10();
        obj.printBinaryFormat(23);
    }
    public void printBinaryFormat(int number)
    {
        int binary[] = new int[25];
        int index = 0;
        while (number > 0)
        {
            binary[index++] = number % 2;
            number = number / 2;
        }
        for (int i = index - 1; i >= 0; i--)
        {
            System.out.print(binary[i]);
        }
    }
}


11101
10111
11001
Compilation Error or Runtime Error

Doubts

Problems

Topic: Static and Non Static Variables - Static and Non Static Methods

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App