x

Java – Types of Errors

PREV     NEXT

Java Types of Errors:


There are three types of errors in java

1.Compile-time errors

2.Run time errors

3.logical errors

Compile time errors:

These errors are errors which prevents the code from compiling because of error in the syntax such as missing a semicolon at the end of a statement or due to missing braces, class not found, etc. These errors will be detected by java compiler and displays the error onto the screen while compiling.

Run time error:

These errors are errors which occur when the program is running. Run time errors are not detected by the java compiler. It is the JVM which detects it while the program is running.


Logical errors:

These errors are due to the mistakes made by the programmer. It will not be detected by a compiler nor by the JVM. Errors may be due to wrong idea or concept used by a programmer while coding.

Exceptions:

Exception is a runtime error which can be handled or prevented and occurs during the execution of the program. Some exceptions can be detected by java compiler while compiling and are called checked exceptions while those detected during runtime by JVM are called unchecked exceptions.

Exception classes:

Throwable is a class in java.lang package and it represents all errors and exceptions.

PREV     NEXT



Like it? Please Spread the word!