Lesson 4: Working with Variables
When working with Java or any programming language, we usually have to deal with storing lots of different types of data called variables. This can be letters, words, integers, irrational numbers, or just about any data type you can imagine. As we will learn over the next couple of lessons, different situations call for different…
Lesson 5: Printing Variables
Going through Lesson 4, we learned about variables, how to name them, and talked about the variable type “String.” This lesson we are going to learn how to print a variable. Let us start off by creating a class called “PrintingStrings” and implement the Java main method. It should look like this: Next, we are…
Lesson 6: Printing Multiple Variables
Now that we know how to print a single variable, we are going to learn how to print multiple variables using one print method. However, lets first talk about another variable type: char. char (which is short for character) is a variable type that is similar to the String type. The main difference is that…
Lesson 7: Numerical Variables
After learning about variables and printing Strings, we are now going to learn about some numerical variables that we encounter in Java. As you will find out with practice, many Java programs require a fair bit of numerical data. The best and most common way to store numerical values are by using the variable types:…
Coding Challenge 2
For this challenge, we are going to construct a class called CodingChallenge2 and use the print method that prints something like the following: My favorite color starts with the letter G and I am 18 years old. Instead of creating one large String, we are going to use the addition symbol to join the following…