Loops in Java

Loops in Java work similarly to how you remember loops in C/C++ most likely. You have your counting loop (for), as well as your pretest conditional loop (while), and the conditional post test loop (do-while). Each of these work the same way you would expect them to in C/C++. For Loop The for loop is…

Console Output in Java

Compared to some languages, you might find writing out basic output in Java…well…overly complex. However, once you understand Java, you will see that it is complex, but for a reason. Let’s first consider some languages you might have already seen. Each one of these prints “Hello World” to your console window. So how does Java…

Conditions in Java

You will find conditions in Java familiar if you are used to using boolean conditions in C/C++. However, noticed that I said boolean conditions. That is because Java wants boolean conditions, those that generate a true or false answer, instead of the C/C++ conditions which actually look for an integer value. Notice the following below…

Java Variables

Inside of a method, like our main method, we might want to create some variables for use. Java gives us numerous primitive data types that we can use, and within a method, we declare and use them, just like we would in C/C++. Comments You might have noticed the comment above. Comments in Java are…

Java’s main Method

Just like in C++, each executable Java project should have a main method. This isn’t just the “main” method that is run, but an actual method called main(). If you look at the previous page for creating a file, we can start from there. This will be a little different from the C++ main method,…