Privacy Policy Terms Of Use. Copyright © 2006-2010 Java Tutorials and Examples.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
- public class BooleanDemo {
- public static void main(String args[]){
- Boolean bObj = new Boolean("Hello World!");
- System.out.println(bObj);
- }
- }
b. Program will throw runtime error
c. Program will print false
d. Program will print true
Answer:
C is the correct choice. Boolean wrapper class has a constructor which accepts string argument. So, there will not be any compilation error. If the string argument is equal to "true" regardless of its case, Boolean object representing value true is created. Otherwise it will be created as false. Hence, C is the correct choice.

Post new comment