Sunday, July 11, 2010

Java Boolean Operators

The Boolean logical operators are : | , & , ^ , ! , || , && , == , != . Java supplies a primitive data type called Boolean, instances of which can take the value true or false only, and have the default value false. The major use of Boolean facilities is to implement the expressions which control if decisions and while loops.

These operators act on Boolean operands according to this table

 A         B             A|B       A&B      A^B      !A false     false         false     false    false    true true      false         true      false    true     false false     true          true      false    true     true true      true          true      true     false    false
| the OR operator & the AND operator ^ the XOR operator ! the NOT operator || the short-circuit OR operator && the short-circuit AND operator == the EQUAL TO operator != the NOT EQUAL TO operator 


Example
     

 class Bool1{     public static void main(String args


--
http://www.co5.in/

0 comments:

Post a Comment

 

Complete Online Solution | Make the internet world into your hands Copyright © 2009 Community is Designed by CO5 | Web designing | Web hosting