Java Convert boolean to StringWe can convert boolean to String in java using String.valueOf(boolean) method. Alternatively, we can use Boolean.toString(boolean) method which also converts boolean into String. 1) String.valueOf()The String.valueOf() method converts boolean to String. The valueOf() is the static method of String class. The signature of valueOf() method is given below: Java boolean to String Example using String.valueOf()Let's see the simple example of converting boolean to String in java. Test it NowOutput: true false 2) Boolean.toString()The Boolean.toString() method converts boolean to String. The toString() is the static method of Boolean class. The signature of toString() method is given below: Java boolean to String Example using Boolean.toString()Let's see the simple code to convert boolean to String in java using Boolean.toString() method. Test it NowOutput: true false Next TopicJava Date to Timestamp |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India