- 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
String representation of Boolean in Java
To get the string representation of Boolean, use the toString() method.
Firstly, we have used the valueOf() method for Boolean object and set a string value.
Boolean val = Boolean.valueOf("false");
The same is then represented using “toString() method.
val.toString();
Let us see the complete example that prints the string representation of Boolean (True and False) in Java.
Example
public class Demo { public static void main(String[] args) { // false Boolean val = Boolean.valueOf("false"); System.out.println("Displaying the string representation of Boolean"); System.out.println(val.toString()); // true val = Boolean.valueOf("true"); System.out.println(val.toString()); } }
Output
Displaying the string representation of Boolean false true
- Related Articles
- Convert the specified string representation of a logical value to its Boolean equivalent in C#
- Convert Java String Object to Boolean Object
- Java Program to convert String to Boolean
- Java Program to convert Boolean to String
- Get the String representation of the current File object in Java
- Parse a string to a Boolean object in Java
- How to get the string representation of numbers using toString() in Java?
- Java Program to create a boolean variable from string
- How to check if String value is Boolean type in java?
- Java example to return a string representation of the deep contents of the array
- Boolean Type in Java
- Boolean Literals in Java
- Create a Boolean object from Boolean value in Java
- Convert Java Boolean Primitive to Boolean object
- Java Boolean operators

Advertisements