Control Statements
Objectives
Applied
- Code if/else statements and switch statements to control the logic of an application.
- Code while, do-while, and for loops to control the repetitive processing that an application requires.
- Code nested for loops whenever they are required.
- Use the break, labeled break, continue, and labeled continue statements to jump out of a loop or to jump to the start of a loop.
- Code a static method that performs a given operation, and code a statement that calls that method.
- Given the Java code for an application that uses any of the language elements presented in this chapter, explain what each statement in the application does.
Knowledge
- Explain how a reference type like a String object is different from a primitive data type.
- Explain what a logical operator is and why you would use one.
- Describe the difference between how the regular logical operators and the short-circuit operators work.
- Compare the if/else and switch statements.
- Explain what it means for execution to fall through a label in a switch statement.
- Describe the differences between while, do-while, and for loops.
- Explain what an infinite loop is and what you must do when one occurs.
- Describe the difference between the break statement and the continue statement.
- Explain what an access modifier is and how it affects the static methods you define.
- Explain what the signature of a method is.