Wednesday, December 15, 2010

Logical NOT operator

The third type of logical operator ! applies to one boolean operands and the result is the inverse of the operand value.So if the value of a boolean variable state, is true then the expression ! state has the value false and if it is false then ! state valuates true. To see how the operators is used with an expression you could rewrite the code fragment you used to provide discounted ticket price as follow.


My dear friend please give me your comments :)
http://worldjavasocietyandme.blogspot.com/

How to use Logical OR operator

The OR operators, | and || apply when you want a true result if either or both of the operands are true. The logical OR , || , has a simile effect to the logical AND in that it omits the evaluation of the right hand operands when the left hand operands is true.Obviously if the left hand operands is the result will be true regardless weather the right operand is true of false.


The effect is to reduce ticket price by 10 percent if  either condition is true.
With an || operation you get a false result only if both operands are false.If either operand is true result is true.

http://worldjavasocietyandme.blogspot.com/