
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
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
Create 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
Advertisements