Chapter2_3-Operators

S gannouni dr a touir introduction to oop logical

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: lt; result = (x > y); • now result is assigned the value false because 3 is not greater than 5 Page 21 Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP Logical Operators Symbol && || ! Name AND OR NOT && F || T F T T F T T T F Page 22 T F F F T F Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP Example boolean x = true; boolean y = false; boolean result; result = (x && y); result is assigned the value false result = ((x || y) && x); (x || y) evaluates to true (true && x) evaluates to true result is then assigned the value true Page 23 Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP Operators Precedence Parentheses (), inside-out Increment/decrement ++, --, from left to right Multiplicative *, /, %, from left to right Additive +, -, from left to right Relational <, >, <=, >=, from left to right Equality ==, !=, from left to right Logical AND && Logical OR || Assignment =, +=, -=, *=, /=, %= Page 24 Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP...
View Full Document

This document was uploaded on 03/03/2014.

Ask a homework question - tutors are online