Menu
Topics Index
...
`

My reaction


If you need explanation Read this topic

If you need Answer Take test on this topic

My reaction
What will be the output of the following program?
public class ResultsTime {
    public static void main(String[] args) {
        Boolean pass = new Boolean();
        pass = true;
        Boolean fail = new Boolean("false");
        if (pass) {
            System.out.println(":)");
        } else {
            System.out.println(":(");
        }
    }
}

A. :(
B. :)
C. Compilation Error
D. Runtime Error
Topic: Java Boolean Class

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

ans ; c
in Boolean constructer ..we can't use string as a parameter

Posted by Ananda Kumar    2014-06-13 03:49:27


ans c
bcz boolean constructors allow only boolean or string variables as parameters
so line 3 throws an error bcz it does not pass any variable as parameter

Posted by Pooja Singh    2014-06-13 05:00:01


Ans is b...because pass is true and the corresponding statement is executed

Posted by Badam Swathi    2014-06-13 08:37:10


Congratulations Pooja Singh. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-06-16 03:39:04


© meritcampus 2019

All Rights Reserved.

Open In App