Styrow.dev
Question 220 of 247
Java Topic: General medium

What is the difference between error and an exception?

Question

What is the difference between error and an exception?

Answer

An error is an irrecoverable condition occurring at runtime. Such as OutOfMemory error. Exceptions are conditions that occur because of bad input etc. e.g. FileNotFoundException will be thrown if the specified file does not exist.