Chapter 8: Escape Sequences, Logical Operators, and Methods

Lesson 28: Escape Sequences

In past lessons, we have gone over a couple of different ways we can manipulate Strings.  We have learned about various print methods and adding spaces with quotation marks to get our desired output.  In this lesson, we are going to go over escape sequences that can help simplify some of our string manipulation, as…

Lesson 29: Logical Operators

Thus far, we have gone over various operators that we have been using to create our Boolean expressions.  However, we have been limited by only using one Boolean expression at time.  In this lesson, we will take a look at logical operators. In Java, there are 3 logical operators: Symbol MeaningCodeAND&&OR||NOT! The logical operator &&…

Lesson 30: Methods

Methods are one of the fundamentals of programming.  As you might recall from our object-oriented programming lesson, we talked about how classes are typically nouns and methods are verbs.  They help reduce redundancy by being able to use them an unlimited amount of times throughout our code for different instances. Thus far, we have been…

Lesson 31: Method Parameters and Arguments

When working with methods, there will be times that we want to keep variables only within our method.  Java has a way of doing this through the usage of parameters.  Parameters are declared within the parenthesis of our method.  Let’s go over an example of a method with parameters. In the example above, we have…

Coding Challenge 8

For the 8th Coding Challenge, we will make a program that has 2 methods. The first method will be a user-made method: static void makeCoffee. This method will also have a parameter: boolean wantsCoffee. Within the user-made method, we will have an if statement that only executes when wantsCoffee is true. The if statement (when…

%d bloggers like this: