Errors

Throughout your coding experience, you'll experience countless errors. It's just a part of life as a programmer. There's 3 types of errors that you'll experience:

Syntax Errors

These errors are caused by incorrect formatting or spelling (e.g., a missing semicolon at the end of a line) and prevent your code from running at all.

How to Solve Them

Compilers automatically underline typos with a red underline, like in the example below.

Runtime Errors

These errors are caused when a program attempts to run a line of code that the compiler considers impossible or invalid.

For example, let's say you tried to divide something by 0. Your code will automatically stop running, and give you a runtime error.

Since there are so many different sources of runtime errors, when a Runtime Error is called, the code will specify why. For example, if you try to do something with a null object (like add a value, check if it's equal to a boolean, etc.) , it will give you a NullPointerException.

Logic Errors

Although these don't stop your code, in some cases they're even worse than the other two.

Last updated