Java examples for Language Basics:boolean
Convert boolean Primitive to Boolean object
public class Main { public static void main(String[] args) { boolean b = true; //from w ww . j av a 2 s .c o m //1. using constructor Boolean blnObj1 = new Boolean(b); //2. using valueOf method of Boolean class. This is a static method. Boolean blnObj2 = Boolean.valueOf(b); } }