Activities

To improve your conditioning in terms of Java conditionals, review the topics of this hour with the following activities:

  • Remove the break statement from one of the lines in the ClockTalk program, and then compile it and see what happens when you run it. Try it again with a few more break statements removed.
  • Create a short program that stores a value of your choosing from 1 to 100 in an integer variable called grade. Use this grade variable with a conditional statement to display a different message for all A, B, C, D, and F students. Try it first with an if statement, and then try it with a switch statement.

To see Java programs that implement these activities, visit the tutorial's website at http://www.java24hours.com.

      
Comments