Control Structures in Java: Implementing Java Control Structures

Java    |    Beginner
  • 12 videos | 1h 43m 50s
  • Includes Assessment
  • Earns a Badge
Rating 4.5 of 75 users Rating 4.5 of 75 users (75)
Before you build any significant Java application, it is important to get familiar with controlling the flow of code using control structures - a fundamental concept in any programming language. And this is precisely the focus of this course. With the help of this course, you'll learn how to work with basic if statements, where code is executed if a certain condition is met and if-else and switch statements, which allow you to check for multiple conditions and run chunks of code accordingly. You'll then delve into for and while loops, which allow you to define a block of code that needs to be executed repeatedly under specific conditions and recognize the use of continue and break statements that influence their behavior. After finishing this course, you'll have the knowledge and skills to control the flow of code execution in your program based on the value of variables or the outcome of operations.

WHAT YOU WILL LEARN

  • Discover the key concepts covered in this course
    Accept user input and implement conditional execution using if statements
    Recognize the syntax of if statements and make use of else blocks
    Use multiple if statements and explore the use of else-if blocks
    Demonstrate how for loops can be used to iterate the contents of a string or array
    Use switch statements to select categories based on a value
  • Describe the different ways in which for loops can be applied, such as nested for loops
    Create a for loop and use the break and continue keywords to control its flow
    Use while loops to perform operations while a condition is true
    Manually compile and run java code from the command line
    Develop and run a java program that accepts input from the command line
    Summarize the key concepts covered in this course

IN THIS COURSE

  • 2m 6s
    In this video, you’ll learn more about your instructor and this course. The course will teach you to implement basic if statements where code is executed if certain conditions are met. You’ll move on to if-else and switch statements, which allow you to check for multiple conditions and run chunks of code. You’ll then delve into loops, which allow you to define a block of code that needs to be executed repeatedly under specific conditions. FREE ACCESS
  • 12m 58s
    In this video, you’ll learn more about control structures. These are statements or sequences of statements allow you to control the flow of program execution. Control structures will allow you to define conditions under which only certain lines of code will be run. And alternatively, define where some lines of code will be run repeatedly. To explore this, you’ll first create a new IntelliJ project. You’ll use version 15 of the SDK in Java. FREE ACCESS
  • Locked
    3.  Illustrating the if-else Statement
    11m 52s
    In this video, you’ll watch a demo. In this demo, you’ll learn more about the if-else statement. These statements tell you where exactly the body ends. To test these out, you’ll add in another line at the end of the previous demo. You’ll print out the message seen onscreen. You’ll see this is not aligned with the previous print statement. However, alignment isn’t significant in Java when it comes to the compiler. FREE ACCESS
  • Locked
    4.  Using Multiple if Statements
    10m 35s
    In this video, you’ll watch a demo. You’ll learn to use multiple if statements. The if statements you’ve defined so far have presented a binary option. If the condition evaluates to true, you perform one set of actions but perform another set of actions otherwise. However, the choices may not this simple and you may need to define multiple blocks of execution to correspond to different conditions. This can be accomplished through multiple if statements. FREE ACCESS
  • Locked
    5.  Demonstrating a Basic for Loop
    7m 52s
    In this video, you’ll watch a demo on basic for loops. An if statement can control which lines of code are executed within your program. You’ll see a for loop can also control execution in that manner. However, it’s often used to execute the same line of code repeatedly. In this demo, you’ll see the user input class has been modified. This will be used to print a message to the screen three times. FREE ACCESS
  • Locked
    6.  Using the switch Statement
    11m 10s
    In this video, you’ll watch a demo. In this demo, you’ll explore the use of a switch statement in Java. This is a special case of an if else statement. If the values you’re dealing with happen to be discrete, which means they can only be equal to a specific set of values, you need a switch statement. You’ll see a new source file and class onscreen, and you’ll see a new run config. FREE ACCESS
  • Locked
    7.  Demonstrating Different Types of for Loops
    11m 9s
    In this video, you’ll watch a demo. You’ll continue looking at for loops but in more depth. You’ll see there’s a new source file, class, and run configuration. First, you’ll paste in the code for a new for loop. You’ll see a very common use case when it comes to for loops is to iterate over the contents of an array and then perform some operations on the elements. That’s what you’ll do here. FREE ACCESS
  • Locked
    8.  Illustrating continue and break Statements
    10m
    In this video, you’ll watch a demo. You’ll learn what to do if you want to end the iterations when a certain condition has been met. For this, you'll need to make use of the break statement. You’ll examine these in this demo. You’ll also work with the continue statement to skip iterations based on a condition. Onscreen, you’ll see the code has been modified within a for loop class. FREE ACCESS
  • Locked
    9.  Using the while Loop
    7m
    In this video, you’ll watch a demo. You’ll take a look at a very closely related control structure, the while loop. In many ways, while loops perform the same actions as for loops, except they have a slightly different syntax. When you know the number of iterations beforehand, the for loop is used. A while loop can be set to continue iterating until a specific condition has been met. FREE ACCESS
  • Locked
    10.  Running Java from the Shell
    8m 20s
    In this video, you’ll watch a demo. You’ll learn to run Java from Shell. When you need to move your code over to production, that’s where you’ll need to execute your Java program, most likely from the command line. You’ll explore that here. You’ll start your development in IntelliJ and run from IntelliJ as well before moving over to the command line. FREE ACCESS
  • Locked
    11.  Supplying Arguments to Java Programs
    9m 4s
    In this video, you’ll watch a demo. In this demo, you’ll introduce code changes. You’ll make sure the item you searched for in the treasure chest is something the user has provided by means of the arguments to a Java program. For that, you’ll assume it’s the first element of the args array, which represents the term to search for. You’ll set the item to args with the index of 0. FREE ACCESS
  • Locked
    12.  Course Summary
    1m 45s
    In this video, you’ll summarize what you’ve learned in this course. You’ve learned to control code execution in programs based on values of variables or the outcome of operations. You learned to implement basic if statements, where chunks of code are executed if certain conditions are met and skipped if not. You then moved on to if else and switch statements, which allow you to check for multiple conditions and run chunks of code. FREE ACCESS

EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE

Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.

Digital badges are yours to keep, forever.

YOU MIGHT ALSO LIKE

Rating 4.6 of 169 users Rating 4.6 of 169 users (169)
Rating 4.6 of 25 users Rating 4.6 of 25 users (25)
Rating 4.7 of 100 users Rating 4.7 of 100 users (100)

PEOPLE WHO VIEWED THIS ALSO VIEWED THESE

Rating 4.5 of 526 users Rating 4.5 of 526 users (526)
Rating 4.6 of 144 users Rating 4.6 of 144 users (144)
Rating 4.4 of 38 users Rating 4.4 of 38 users (38)