The course is part of this learning path
This course explores the fundamental concepts and syntax associated with Control Flow and showcases these with some real-life projects.
- Learn about the three categories of control statements: sequential, selection, and repetition
- Manipulate control statements using the continue and break statements
- Learn about pseudo-random numbers and the Random class
- Beginner coders or anyone new to Java
- Experienced Java programmers who want to maintain their Java knowledge
- Developers looking to upskill for a project or career change
- College students and anyone else studying Java
This is a beginner-level course and can be taken by anyone with an interest in learning about Java.
This section was full of foundational material. It contained the necessary syntax and skills to modify the flow of control in a program, specifically by using control statements. We learned the three categories of control statements, sequential or sequence, selection, and repetition. We also learned specific syntax for selection control statements including if, if-else, and switch, as well as the specific syntax used for repetition control statements, including while, do-while, and for.
Furthermore, we discussed various ways to categorize and use the repetition control statements, also known as loops, in terms of when their tests are performed. For instance, we learned that while and for loops are pre-test loops, which performed their loop continuation condition tests before the body is executed, and that the do-while loop is post-test, which means the loop continuation condition test is performed after the body is executed. This means, do-while is guaranteed to execute at least once, even if going into the loop the condition is already false.
Another way to categorize repetition control statements has to do with the fundamental essence of the loop continuation statement. That is, is the loop controlled by a counter that runs the loop a certain number of times, which is called counter-controlled repetition, or does the loop run an indefinite number of times until it encounters a special value or values called the sentinel value, in sentinel controlled repetition?
Later on, we learned how to interrupt the typical behavior of loops using the break and continue statements. And to top things off, we learned about random number generators, a side topic, but one that works well in a variety of situations and are useful once we've learned about control statements. We specifically learned about the random class, which lives in the Java.util package. We've done a ton of work in this section. I'm extremely excited that we get to move on to our very first data structures, which are containers of data. In the next section, we'll look at both built-in arrays and the array list. I'll see you there.
John has a Ph.D. in Computer Science and is a professional software engineer and consultant, as well as a computer science university professor and department chair.