 There are three types of errors that you can make in your Java programs. The first type is called a syntax error. A syntax error happens when you say something that's not grammatically correct in Java. In this program I've said 34 plus times 8, which doesn't make any sense mathematically. And when I compile the program, the compiler shows me that it is indeed a syntax error. It also points out where Java got confused. You can have another kind of error called a run time error. This happens when your program tries to do something incorrect when it runs. For example, if I try to evaluate 42 divided by 0, that's grammatically correct. I have a number, a division sign, and another number. And Java compiles that just fine. But when it comes time to actually run that calculation, I get an error telling me that I have an arithmetic exception. I'm trying to divide by 0. It also points out which line was executing when the error occurred. These two types of errors are usually pretty easy to find. Syntax errors are the easiest because the compiler points them right out to you. And run time errors are fairly easy as well because once you run the program, you see the error of front and center. The third type of error is called a semantic error, which means you told the program to do something, but it wasn't what you wanted it to do. For example, if I want to find out approximately how many days there are in 21 years, and I run this program, 386 is nowhere near the correct answer. The problem is here on line 7. Instead of multiplying by 365, I added 365. That's not a syntax error. A plus sign is just as valid to do as a multiply. It's not a run time error because adding 21 and 365 won't cause the program to crash. It's not what I intended to do, which is why I got the wrong output, and that makes it a semantic error. These semantic errors are, in general, the hardest ones to find because it's only when you look at the output that you realize this is not what I intended, and then you have to go back to your program and figure out what you did wrong. Sometimes Java will appear to point out the wrong line for a syntax error. Let's look at the compilation of this program. Java says I have an error on line 7, but if I look at line 7, everything looks perfectly okay. Their error is really here on line 6, where I put a plus sign instead of a semicolon at the end of the line. Why did Java say the error was on line 7? The answer is because of the way Java parses your programs when it compiles them. Have you ever buttoned your shirt and found out when you got to the bottom that you're out of buttons? Now, where did that error start? Did it start at the bottom, or was it somewhere up further on? The answer usually is that it was up somewhere near the top and you forgot a button or buttonhole, and that's why you're out of buttons when you get to the bottom of the shirt. Java works in somewhat the same way. It's on line 6, it is okay, this is a great variable name, equal sign is cool, 21's a normal integer, a plus sign is perfectly valid here, and oh, I'm at the end of the line. There's nothing after the plus sign. Well, maybe the other operand is on the next line. Java goes to the next line, and when it finally gets to age and days, it says, wait a minute, I can't possibly make a valid Java statement out of this. The compiler throws its hands in the air, gives up and says, okay, the error must be here on line 7. This shirt is out of buttons. The moral of the story, when you get a syntax error, Java will give you the line number where it gave up, where it could not go any further and make a valid program. This means that your error may be on that line, but it also may be somewhere above where the error truly started to happen, just like when you buttoned your shirt wrong. The first few times that you get an error, you're going to sort of freak out and you'll have no idea what's going on. Don't panic. Take a deep breath, look carefully at the error message, read it completely, figure out whether it's a syntax error or a runtime error, and then look carefully at the line where the error occurred. And again, because of our shirt buttoning problem, you might need to look a little bit above where the error was pointed out if you have a syntax error. After a while, you'll get used to seeing some of these errors come up, and when you see an error, you won't need to freak out. You'll say, oh, yeah, I remember that one, and I remember how I fixed it, and your programming will be ever so much faster.