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/
My dear friends,my site is all about JAVA programming language.I think all you know about Java.It is an Open source language.My vision is to share my Java programming language all over the world.Here is the mission for that.So please feel free to share your programming with this blog.Java is on the top of best programming language in the world.It is not a difficult language to learn.So please be with me until my Java video lessons come.I need your feedback.Lets ruin the world with JAVA.
Wednesday, December 15, 2010
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/
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/
Subscribe to:
Posts (Atom)