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 235 views
1 answer 252 views
1 answer 259 views
1 answer 216 views
3 answers 406 views
4 answers 482 views
482 views asked Nov 8, 2016 by avibootz
4 answers 503 views
503 views asked Nov 8, 2016 by avibootz
...