- 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
Convert Java Boolean Primitive to Boolean object
To convert Boolean Primitive to Boolean object, use the valueOf() method in Java.
Firstly, let us take a boolean primitive.
boolean val = false;
To convert it into an object, use the valueOf() method and set the argument as the boolean primitive.
Boolean res = Boolean.valueOf(val);
Let us see the complete example to learn how to convert Boolean Primitive to Boolean object.
Example
public class Demo { public static void main(String[] args) { boolean val = false; // converting to object Boolean res = Boolean.valueOf(val); System.out.println(res); } }
Output
False
- Related Articles
- Convert Java String Object to Boolean Object
- Java Program to convert boolean value to Boolean
- Create a Boolean object from Boolean value in Java
- 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
- Parse a string to a Boolean object in Java
- JavaScript Convert a string to boolean
- Convert long primitive to Long object in Java
- Golang Program to convert Boolean to String
- Java Boolean operators
- Convert short primitive type to Short object in Java
- Convert byte primitive type to Byte object in Java
- How to convert Boolean to String in JavaScript?

Advertisements