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 236 views
1 answer 253 views
1 answer 260 views
1 answer 217 views
3 answers 408 views
4 answers 483 views
483 views asked Nov 8, 2016 by avibootz
4 answers 504 views
504 views asked Nov 8, 2016 by avibootz
...