- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- 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
Advertisements