L08-Boolean-exp1 - King Fahd University of Petroleum...

Info icon This preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
ICS102 Lecture 8: Boolean Expressions King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science Department
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
December 6, 2010 ICS102: The course 2 Outline Introduction Java Comparison Operators Evaluating Boolean Expressions Pitfall:  Using  ==  with Strings Lexicographic and Alphabetical Order Building Boolean Expressions Truth Tables Short-Circuit and Complete Evaluation Precedence and Associativity Rules Evaluating Expressions Rules for Evaluating Expressions
Image of page 2
December 6, 2010 ICS102: The course 3 - Introduction A Boolean expression is an expression that is either  true  or  false The simplest Boolean expressions compare the value of two  expressions time < limit yourScore == myScore Note that Java uses two equal signs ( == ) to perform equality  testing:  A single equal sign ( = ) is used only for assignment
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
December 6, 2010 ICS102: The course 4 - Java Comparison Operators
Image of page 4
December 6, 2010 ICS102: The course 5 - Evaluating Boolean Expressions Even though Boolean expressions are used to control branch and  loop statements,  Boolean expressions can exist independently as  well A Boolean variable can be given the value of a Boolean expression by  using an assignment statement A Boolean expression can be evaluated in the same way that an  arithmetic expression is evaluated The only difference is that arithmetic expressions produce a number 
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.
  • Fall '08
  • ZAMAN
  • Saudi Arabia, Fahd of Saudi Arabia, King Fahd University of Petroleum & Minerals College of Computer Science & Engineering

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern