Sign In | Subscribe
Start learning today, and be successful in your academic & professional career. Start Today!
Loading video...
This is a quick preview of the lesson. For full access, please Log In or Sign up.
For more information, please see full course syllabus of Introduction to Java
  • Discussion

  • Study Guides

  • Download Lecture Slides

  • Table of Contents

  • Related Services

Bookmark and Share
Lecture Comments (8)

0 answers

Post by Sri Aadarsh Nalluri on March 16 at 12:44:23 PM

are there any video lectures later in which we use these to write and correct code
because till now we never had any examples to work the rules.

2 answers

Last reply by: Malik Hall
Mon Sep 21, 2015 7:42 PM

Post by Malik Hall on September 20, 2015

Hi Professor QUayle, I was a bit confused about the not operator. Would there be a truth value stated before and then for example if (!found) but found was described before as false then what would it's truth value be?

1 answer

Last reply by: Professor Quayle
Tue Jan 6, 2015 10:34 PM

Post by Jingwei Xie on January 6, 2015

In the example of short-circuit evaluation, shouldn't it be:

"numScores ! = = 0"  ?

1 answer

Last reply by: Professor Quayle
Mon Oct 1, 2012 2:53 PM

Post by William Gould on September 30, 2012

I have a problem from my textbook id like to see.

"What are all the possible results of the expression (n % 5), where n is an integer variable?"

I didn't really understand how to go about this. How do you set it up for the result?

Equality, Relational, & Logical Operators

  • The == operator tests for equality; remember not to use = for this
  • The other relational operators are != (not equal to), < (less than), <= (less than or equal to), > (greater than), and >= (greater than or equal to)
  • Logical AND operator is &&; a && b is true only if a is true and b is also true
  • Logical OR operator is ||; a || b is true if either a is true or b is true (or both are true)
  • Logical NOT operator is !; !a is true is a is false; !a is false if a is true

Equality, Relational, & Logical Operators

Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

  • Intro 0:00
  • Roadmap 0:11
  • Equality and Relational Operators 1:09
    • Equal to
    • Not Equal to
    • Relational Operators
  • Logical Operators 3:44
    • Three Operators: And, Or, Not
    • AND Defined
    • OR Defined
    • NOT Defined
    • Example: And
    • Example: Or
    • Example: Not
  • Truth Tables 7:16
    • Truth Tables for AND
    • Truth Tables for OR
    • Truth Tables for NOT
  • Short-Circuit Evaluation 10:03
    • Example
    • This Behavior Can be Useful in Program Design
  • De Morgan's Laws 13:53
    • First Law
    • Second Law
  • Operator Precedence 15:28
    • List of Operators in Highest to Lowest Precedence
    • Evaluation on Operators
  • Summary 20:26