Runtime Errors

🙋 Need help? Ask an expert now!

There are three types of errors that programmers frequently encounter. Let's examine the first one, runtime error or runtime exceptions, by looking at the example below.
package exlcode;

public class RunTimeErrorExample {

  public static int exampleVariableOne = 5;
  public static int exampleVariableTwo = exampleVariableOne/0;

  public static void main(String[] args) {
    // this creates an error because numbers cannot be divided by zero

When we run the code above, an error occurs and nothing is printed out onto the console. Runtime errors happen after the code is compiled and when the program runs the code. Because these errors cause the program to crash, they are hard to track down. In these cases, using comments to group off parts of the source code to narrow down the location of the error is a useful approach.

In the example above, we encounter a runtime error because the program is unable to divide by zero. In these types of errors, the program reaches something illegal, something it is unable to understand, or if it's unable to find the code.

Application Question

The program suffers a run-time error if the _____.