Sign In | Subscribe

Enter your Sign on user name and password.

Forgot password?
  • Follow us on:
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

Lecture Comments (1)

0 answers

Post by Ying Feng on January 30, 2017

Dear Professor,

How to solve the following problem:

// precondition: x>=0
public void mystery(int x)
 if ((x/10)!=0)

Looking forward to your response.

best regards,


Conditional Statements

  • The if statement adds decision-making capability to a program
  • The if-else statement takes one of two actions based on a condition
  • If and if-else statements can be nested as many levels deep as desired
  • The extended-if statement takes one of many actions based on multiple conditions
  • The switch statement is another way to take one of many actions (not in AP subset)

Conditional Statements

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:09
  • Conditional Statements 0:55
    • Based on Value of a Boolean Expression
    • Switch Statement
  • The If Statement 2:59
    • Structure of If Statement
  • The If-Else Statement 4:46
  • The If-Else Statement 6:02
    • If expression - False
  • Nested If-Else Statements 7:13
    • 'Nest'
  • Nested If-Else Statements 7:56
    • First Thing to Determine
    • Code
  • The Extended If Statement 13:14
    • Code
  • The Switch Statement 18:54
    • The Way It Works
    • Example: Switch Statement in a Java Program
  • Summary 27:03