Monday, October 15, 2012

Boolean Example in java

public class JavaBooleanExample {
        public static void main(String[] args) 
     {
              
       

                boolean b1 = true;
                boolean b2 = false;
                boolean b3 = (10 > 2)? true:false;
              
                System.out.println("Boolean variable b1 is :" + b1);
                System.out.println("Boolean variable b2 is :" + b2);
                System.out.println("Boolean variable b3 is :" + b3);           
        }
}


Output
 Boolean variable b1 is :true
 Boolean variable b2 is :false
 Boolean variable b3 is :true

No comments:

Post a Comment