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 156 views
1 answer 177 views
1 answer 178 views
1 answer 146 views
3 answers 274 views
4 answers 333 views
333 views asked Nov 8, 2016 by avibootz
4 answers 340 views
340 views asked Nov 8, 2016 by avibootz
...