 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to convert boolean value to Boolean
Use the valueOf() method to convert boolean value to Boolean. Firstly, let us take a boolean value.
boolean val = false;
Now, to convert it to Boolean object, use the valueOf() method.
Boolean res = Boolean.valueOf(val);
Let us now see the complete example to convert boolean value to Boolean.
Example
public class Demo {    public static void main(String[] args) {       boolean val = false;       System.out.println("Boolean Value = "+val);       Boolean res = Boolean.valueOf(val);       System.out.println("Boolean = " + res);       if (res.equals(Boolean.TRUE)) {          System.out.println("Boolean = " + res);       } else {          System.out.println("Boolean = " + res);       }    } }  Output
Boolean Value = false Boolean = false Boolean = false
Advertisements
 