Menu
Question Index
...

What will be the output of the following program?

import java.io.*;
public class Mobile {
    public static void main(String[] args) throws IOException {
        byte[] sim = {0, 1};
        InputStream inbox = new ByteArrayInputStream(sim);
        DataInputStream outbox = new DataInputStream(inbox);
        while (outbox.available() > 0) {
            System.out.println(outbox.readBoolean());
        }
    }
}


true
true
false
false
false
true
true
false
Compilation Error or Runtime Error

Doubts

Problems

Topic: DataInputStream And DataOutputStream In Java

Read this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App