- 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
Create a Boolean object from Boolean value in Java
To create a Boolean object from Boolean value is quite easy. Create an object with Boolean and set the Boolean value “true” or “false”, which are the Boolean literals.
Let us now see how “true” value is added.
Boolean bool = new Boolean("true");
In the same way, “False” value is added.
Boolean bool = new Boolean("false");
The following is an example displaying how to create a Boolean object from Boolean value.
Example
public class Demo { public static void main(String[] args) { Boolean bool = new Boolean("true"); System.out.println(bool); bool = new Boolean("false"); System.out.println(bool); } }
Output
True False
- Related Articles
- Convert Java Boolean Primitive to Boolean object
- Java Program to convert boolean value to Boolean
- How to create a Boolean object in JavaScript?
- Java Program to create a boolean variable from string
- Convert Java String Object to Boolean Object
- Parse a string to a Boolean object in Java
- Create a boolean mask from an array in Numpy
- Use boolean value to stop a thread in Java
- Updating boolean value in MySQL?
- Boolean Type in Java
- Boolean Literals in Java
- Java Boolean operators
- Initialize the mask to homogeneous boolean array by passing in a scalar boolean value in Numpy
- Generate Random boolean in Java
- How to create boolean column in MySQL with false as default value?

Advertisements