[an error occurred while processing this directive]

Java error code

                         

Java Error code are the set of error that occurs during the compile-time and Run-time. From java error we have given  you a sample of code that makes you to understand the java error code in a better way.

Understand with Example

In this Tutorial we want to describe you a code that help you in understanding a Java error code. For this we have a class name 'Error code'. Inside the main method we have an array list that is used to store when there is a large variation in the amount of data to be taken. The array hold the constant amount of data like number of month in a year, but unlike array list  there is no upper bound for the array list. The list is used to add integer as a wrapper because array list never hold the primitive data in the try block. There is a subsequent a catch block is after the try block to caught the exception occurred in the try block.

On execution the given code, the prompt will show you an Null pointer exception, because we do not specify the size of an array. This result in java error code.

JavaErrorCode

import java.util.*;

public class Errorcode {

    public static void main(String[] args
        {

        ArrayList list = null;
        try {
            list.add(1new Integer(1));
        catch (Exception ex) {
            System.out.println(ex);
        }
    }
}

Output

compile-single:
run-single:
java.lang.NullPointerException
BUILD SUCCESSFUL (total time: seconds)

For removing this runtime error you have to specify the size of the Array.

Download code

                         

[an error occurred while processing this directive]