How to convert a boolean into a String using valueOf() in Java

1 Answer

0 votes
package javaapplication1;

public class JavaApplication1 {

    public static void main(String[] args) {

        try {

            String s = String.valueOf(true);
            
            System.out.println(s);

        } catch (Exception e) {
            System.out.print(e.toString());
        }
    }
}

/*
           
run:
     
true
  
 */

 



answered Nov 22, 2016 by avibootz

Related questions

...