Please enable JavaScript to use CodeHS

AP Computer Science A (Mocha)

Lesson 2.11 If Statements

Description

In this lesson, students will explore the use of if statements in Java to control the flow of their programs based on boolean conditions. They will practice implementing and nesting if statements to solve various problems, including determining even and odd numbers, finding minimum values, and evaluating voting eligibility. Through hands-on activities and exercises, students will gain a deeper understanding of conditional logic and its applications in programming.


Objective

Students will be able to:

  • Understand and use if statements to control program flow
  • Implement nested if statements to solve complex problems
  • Use the modulus operator and string methods in conditional expressions