Help with the difference between error and exception

Im having a really hard time understanding the concept and the differences between errors and exception. i’m really looking for a definition and example of each. something to help me understand this. i dont know Java but would like to understand the differences between the two. i could be overthinking but i want to make sure

Error: An Error indicates serious problem that a reasonable application should not try to catch.
Exception: Exception indicates conditions that a reasonable application might try to catch.

Have you tried looking at:

It goes through several different examples that you might find easy to understand.

1 Like

In programming, Errors are divided into 3 main categories :

  1. Syntactical Errors (syntax errors): common with programming languages that are compiled (eg. java) that show errors in the code, example:
int age = "20";  /*type error , expected int value not String*/
  1. Logical Errors or Bugs: the compiler usually don’t notify you about them, for example, performing division by 0
double result = 10 / 0;
  1. Runtime Errors (exceptions): as @caleb-mabry said, they are the kind of errors that you don’t know when they happen (before compilation), but you can catch them at runtime (in execution phase), a common exception in java is when calling object methods on null, doing so will throw a NullPointerException , example:
String name = null;
if(name.equals("me")) /* throws NullPointerException */
        System.out.print("its me");