How to set value to Boolean object in Java

3 Answers

0 votes
package javaapplication1;

public class JavaApplication1 {

    public static void main(String[] args) {

        Boolean bObj = Boolean.valueOf("true");
        System.out.println(bObj);
    }
}
   
/*
      
run:
      
true
  
*/

 



answered Nov 8, 2016 by avibootz
0 votes
package javaapplication1;

public class JavaApplication1 {

    public static void main(String[] args) {

        Boolean bObj = true;
        System.out.println(bObj);
    }
}
   
/*
      
run:
      
true
  
*/

 



answered Nov 8, 2016 by avibootz
0 votes
package javaapplication1;

public class JavaApplication1 {

    public static void main(String[] args) {

        boolean b = true;
        
        Boolean bObj = b;
        System.out.println(bObj);
    }
}
   
/*
      
run:
      
true
  
*/

 



answered Nov 8, 2016 by avibootz

Related questions

1 answer 161 views
1 answer 181 views
1 answer 183 views
1 answer 153 views
3 answers 280 views
4 answers 337 views
337 views asked Nov 8, 2016 by avibootz
4 answers 348 views
348 views asked Nov 8, 2016 by avibootz
...