Summary
This chapter covered a lot of Java syntax—things you need to learn to be able to tackle the more advanced topics. You'll find yourself using these techniques in just about every Java application you write.
We started out by controlling the flow of the program using conditional statements such as if
, else if
, else
, and switch
statements. We then moved on to the different loops that can be used to perform repetitive tasks. After this, we looked at how to provide values during runtime using command-line arguments. This is one way to pass inputs to your Java applications. Every example in this chapter created a class, but we have not yet done much with these classes.
In the next chapter, you'll learn about classes, methods, and object-oriented programming, and how you can do a lot more with classes.