Java Syntax and Exceptions
In this chapter, we will begin by looking at the syntax of the Java language. It might seem strange that it took till this chapter to look at syntax. To understand why, I must let you in on a secret: you already know how to code. This is the audience this book is for – you can program but have little or no experience with Java. I have no doubt that you could understand what was happening in every code sample you have seen so far. We will now formalize the Java syntax.
Here are the topics we will cover:
- Understanding coding structures
- Handling exceptions
By the end of this chapter, you will be able to organize Java code into methods and classes. Decision-making and iteration in Java code are presented. When things go wrong, there can be, in many situations, the need to leave the code that caused the error and either carry out additional processing to solve the problem or exit the program. This is the role of exceptions.