Understanding if statements
Today, we're going to explore the very basic if
and else
conditional statements. To understand this further, refer to the following bullet list:
- Let's create a new Java project in NetBeans. I'm going to call mine
ConditionalStatements
, and I will allow NetBeans to create themain
class for me; refer to the following screenshot:

To keep things clean, we can get rid of all our comments; now we're good to go. To allow us to write more interesting programs, we're going to quickly learn how to do some basic user input in Java. At this point in time, you don't have the knowledge base to fully grasp the intricacies of what we're about to do, but you may have a basic understanding of what's going on and you can certainly repeat the process on your own in future.
While writing to this InputStream/Console window is kind of a simple fire-and-forget process, reading input in Java can be a little more complicated:

- User input is put into a buffer that our program accesses when...