- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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
- Related Articles
- Convert Java Boolean Primitive to Boolean object
- Java Program to convert integer to boolean
- Java Program to convert String to Boolean
- Java Program to convert Boolean to String
- Java Program to convert boolean to integer
- Golang Program to convert Boolean to String
- Convert Java String Object to Boolean Object
- Create a Boolean object from Boolean value in Java
- How to convert a boolean value to string value in JavaScript?
- Swift program to convert boolean variable into string
- C++ Program to convert Boolean Variables into String
- How to convert a value into Boolean in JavaScript?
- Java Program to convert an int to a boolean specifying the conversion values
- Java Program to convert an Integer to a boolean specifying the conversion values
- Convert a specified value to an equivalent Boolean value in C#

Advertisements