Programming is fun. No, really. As long as you can get your thing working, there's loads of satisfaction to be gained from doing it. I hope these pages will help you to defeat any nasty compiler errors you might ever get.
If you've got a specific problem, the index of answers by time or by category is your best bet. There's also some general advice on crashers and unexpected functionality. One way to defeat lots of bugs is to use a nice editor. Also, check out the range of code samples.
In code blocks, comments are like this. Example changes to code are highlighted like this. Code commented on might be highlighted like this. Where there are unknown parts to an error message, they are written like this: <description>. This will be something like the name of a variable.
The cause of many bugs is simply a typo. Java is case sensitive, so that numCats and NumCats would be treated as different variables. Checking for these before changing anything else is a good idea. Also, some bugs can cause other bugs. If you've not declared a variable correctly, then any time you refer to that variable, you'll get an error. If you've fixed some bugs, and a new set comes up, don't panic! It probably means the complier has got further on in your code, and found some more errors.
If lots of bugs appear, don't panic! If there are some obvious ones, such as badly declared variables, then fix those first. Don't forget that if you refer to a variable three times, you might get three errors. Once you've cleared out the obvious ones, the not-so-obvious ones will become clearer. Quite often, some bugs will be causing other bugs, so fix things that look wrong before those that look right.
Sometimes, a bug will be so obvious, you won't be able to see it. There will be something like = instead of ==, or a semicolon out somewhere. That's when it's time to get a friend to have a look for what's wrong. The mind has the "useful" habit of correcting things that seem wrong. It may be ignoring the error, because it knows you don't make mistakes, and the eyes must be seeing it wrongly.
The major difference between a thing
that might go wrong and a thing that cannot possibly go wrong is that when a
thing that cannot possibly go wrong goes wrong it usually turns out to be
impossible to get at or repair
- Douglas Adams, "Mostly Harmless"
You may be wondering what on earth that has to do with your programming. It seems so relavant to so many of the articles (to me, at least), that I put it here. Whenever I mention being on the safe side, think of that quote.