source code Boolean class
package wclasses;
public class SampleBoolean {
public static void main(String att[])
{
// constructors
Boolean b1= new Boolean("true");
Boolean bd=new Boolean(true);
// wrapper to primitive
boolean pb1=b1.booleanValue();
System.out.println(pb1);
//primitive to string
String s1=b1.toString();
String s2=Boolean.toString(true);
System.out.println(s1);
System.out.println(s2);
//String to primitive
boolean pb2=Boolean.parseBoolean(s2);
System.out.println(pb2);
//String to wrapper object
Boolean b2= new Boolean("10");
Boolean b3=Boolean.valueOf("100");
System.out.println(b2);
System.out.println(b3);
//wrapper to string
String s3=b3.toString();
}
}
output:
true
true
true
true
false
false